mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-21 03:13:42 +08:00
Corrected a static-memory overrun. It was causing a segfault on my
32-bit linux VM, but nowhere else. Coverity identified the issue (defect 743616), and correcting it fixed the crash.
This commit is contained in:
parent
7e6ffcb334
commit
876861cc07
@ -777,7 +777,7 @@ dap_repairname(char* name)
|
||||
for(p=name,q=newname;(c=*p);p++) {
|
||||
if(strchr(badchars,c) != NULL) {
|
||||
int digit;
|
||||
char newchar[3];
|
||||
char newchar[4];
|
||||
newchar[0] = '%';
|
||||
digit = (c & 0xf0) >> 4;
|
||||
newchar[1] = hexdigits[digit];
|
||||
@ -785,7 +785,7 @@ dap_repairname(char* name)
|
||||
newchar[2] = hexdigits[digit];
|
||||
newchar[3] = '\0';
|
||||
strcat(newname,newchar);
|
||||
q += 3; /*strlen(newchar)*/
|
||||
q += 4; /*strlen(newchar)*/
|
||||
} else
|
||||
*q++ = c;
|
||||
*q = '\0'; /* so we can always do strcat */
|
||||
|
Loading…
Reference in New Issue
Block a user