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)
|
if(chop + (unsigned long)(tmp-buf) < sizeof buf)
|
||||||
tmp[chop] = '\0';
|
tmp[chop] = '\0';
|
||||||
/* replace non-ASCII characters with '?' and return the number of chars */
|
/* replace non-ASCII characters with '?' and return the number of chars */
|
||||||
for(;;){
|
while(i < chop){
|
||||||
c = *tmp;
|
c = *tmp;
|
||||||
tmp++;
|
tmp++;
|
||||||
if(!c) break;
|
if(!c) break;
|
||||||
|
Loading…
Reference in New Issue
Block a user