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:
Ward Fisher 2012-11-20 23:00:17 +00:00
parent 7e6ffcb334
commit 876861cc07

View File

@ -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 */