libxlsxwriter/third_party/tmpfileplus/tmpfileplus.c in fast_excel-0.2.6 vs libxlsxwriter/third_party/tmpfileplus/tmpfileplus.c in fast_excel-0.3.0
- old
+ new
@@ -167,11 +167,11 @@
{
char *ptr = getenv(varname);
buf[0] = '\0';
if (ptr)
{
- strncpy(buf, ptr, bufsize);
+ strncpy(buf, ptr, bufsize-1);
buf[bufsize-1] = '\0';
return buf;
}
return NULL;
}
@@ -187,10 +187,10 @@
* pfx is not NULL and points to a valid null-terminated string
* tmpname_ptr is not NULL.
*/
{
FILE *fp;
- int fd;
+ int fd = 0;
char randpart[] = "1234567890";
size_t lentempname;
int i;
char *tmpname = NULL;
int oflag, pmode;