mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-01-30 16:10:44 +08:00
Addressed Coverity issues 711911, 1102823
This commit is contained in:
parent
8b368d0c3b
commit
23cf133b39
@ -2626,9 +2626,12 @@ nc4_rec_write_metadata(NC_GRP_INFO_T *grp, int bad_coord_order)
|
||||
done:
|
||||
if(oldfullname) free(oldfullname);
|
||||
if(newfullname) free(newfullname);
|
||||
if(retval) return retval;
|
||||
if(retval) {
|
||||
if(tmp)
|
||||
grp->name = tmp;
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
/* If there are any child groups, write their metadata. */
|
||||
for (child_grp = grp->children; child_grp; child_grp = child_grp->next)
|
||||
if ((retval = nc4_rec_write_metadata(child_grp, bad_coord_order)))
|
||||
|
@ -27,7 +27,7 @@ define_netcdf(void)
|
||||
file name, but oh well.
|
||||
*/
|
||||
if(netcdf_name) { /* -o flag name */
|
||||
strcpy(filename,netcdf_name);
|
||||
strncpy(filename,netcdf_name,2048);
|
||||
} else { /* construct a usable output file name */
|
||||
if (cdlname != NULL && strcmp(cdlname,"-") != 0) {/* cmd line name */
|
||||
char* p;
|
||||
@ -41,7 +41,7 @@ define_netcdf(void)
|
||||
strncpy(filename,datasetname,2048); /* Reserve space for extension, terminating '\0' */
|
||||
}
|
||||
/* Append the proper extension */
|
||||
strcat(filename,binary_ext);
|
||||
strncat(filename,binary_ext,2048-(strlen(filename) + strlen(binary_ext)));
|
||||
}
|
||||
|
||||
/* Execute exactly one of these */
|
||||
|
Loading…
Reference in New Issue
Block a user