proc/devname.c: Prevent off-by-one overflow in dev_to_tty().
This commit is contained in:
parent
9f59bd5c52
commit
730bdc33e7
@ -348,7 +348,7 @@ abbrev:
|
|||||||
if((flags&ABBREV_TTY) && !strncmp(tmp,"tty", 3) && tmp[3]) tmp += 3;
|
if((flags&ABBREV_TTY) && !strncmp(tmp,"tty", 3) && tmp[3]) tmp += 3;
|
||||||
if((flags&ABBREV_PTS) && !strncmp(tmp,"pts/", 4) && tmp[4]) tmp += 4;
|
if((flags&ABBREV_PTS) && !strncmp(tmp,"pts/", 4) && tmp[4]) tmp += 4;
|
||||||
/* gotta check before we chop or we may chop someone else's memory */
|
/* gotta check before we chop or we may chop someone else's memory */
|
||||||
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(;;){
|
for(;;){
|
||||||
|
Loading…
Reference in New Issue
Block a user