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
730bdc33e7
commit
6b7ceb36a4
@ -351,7 +351,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