Corrected an issue in genlib.c where a strcpy was used with overlapping buffers.

This commit is contained in:
Ward Fisher 2013-10-30 16:04:35 -06:00
parent 508ee74874
commit 93a3897dab
3 changed files with 6 additions and 4 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@ html
doxygen*.tmp
\#*.*\#
autom4te.cache
myhtml

View File

@ -36,12 +36,13 @@ define_netcdf(void)
p = strrchr(filename,'.');
if(p != NULL) {*p= '\0';}
p = strrchr(filename,'/');
if(p != NULL) {strncpy(filename,p+1,2048);}
} else {/* construct name from dataset name */
if(p != NULL) {memmove(filename,(p+1),2048);}
} else {/* construct name from dataset name */
strncpy(filename,datasetname,2048); /* Reserve space for extension, terminating '\0' */
}
/* Append the proper extension */
strncat(filename,binary_ext,2048-(strlen(filename) + strlen(binary_ext)));
strncat(filename,binary_ext,2048-(strlen(filename) + strlen(binary_ext)));
}
/* Execute exactly one of these */

View File

@ -415,7 +415,7 @@ char*
pooldup(const char* s)
{
char* sdup = poolalloc(strlen(s)+1);
strcpy(sdup,s);
strncpy(sdup,s,(strlen(s)+1));
return sdup;
}