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:
parent
a3111efa71
commit
0e365c8930
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user