mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-02-17 16:50:18 +08:00
Corrected an issue in genlib.c where a strcpy was used with overlapping buffers.
This commit is contained in:
parent
508ee74874
commit
93a3897dab
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@ html
|
||||
doxygen*.tmp
|
||||
\#*.*\#
|
||||
autom4te.cache
|
||||
myhtml
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user