0039-proc/devname.c: Never write more than "chop" characters.

This should be guaranteed by "tmp[chop] = '\0';" and "if(!c) break;" but
this patch adds a very easy belt-and-suspenders check.
This commit is contained in:
Qualys Security Advisory 1970-01-01 00:00:00 +00:00 committed by Craig Small
parent a3111efa71
commit 0e365c8930

View File

@ -350,7 +350,7 @@ abbrev:
if(chop + (unsigned long)(tmp-buf) < sizeof buf)
tmp[chop] = '\0';
/* replace non-ASCII characters with '?' and return the number of chars */
for(;;){
while(i < chop){
c = *tmp;
tmp++;
if(!c) break;