Re-order terms to avoid potential pointer overflow, and remove one
more potential buffer overflow. Submitted by: bde
This commit is contained in:
parent
753da60320
commit
43ec585267
@ -174,7 +174,12 @@ casedot:
|
||||
* to be the successor of tab.
|
||||
*/
|
||||
do {
|
||||
strcat(added, oncol ? (BC ? BC : "\b") : UP);
|
||||
const char *extra;
|
||||
|
||||
extra = oncol ? (BC ? BC : "\b") : UP;
|
||||
if (strlen(added) + strlen(extra) >= 10)
|
||||
return ("OVERFLOW");
|
||||
strcat(added, extra);
|
||||
which++;
|
||||
} while (which == '\n');
|
||||
}
|
||||
@ -215,7 +220,7 @@ casedot:
|
||||
goto toohard;
|
||||
}
|
||||
}
|
||||
if (dp+strlen(added)+1 > &result[MAXRETURNSIZE])
|
||||
if (strlen(added) >= &result[MAXRETURNSIZE] - dp)
|
||||
return ("OVERFLOW");
|
||||
strcpy(dp, added);
|
||||
return (result);
|
||||
|
Loading…
x
Reference in New Issue
Block a user