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 730bdc33e7
commit 6b7ceb36a4

View File

@ -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;