rem: tmp[chop] = '\0';
add: if(tmp + chop - buf <= PAGE_SIZE) tmp[chop] = '\0';
context: int dev_to_tty(char *ret, int chop, int dev, int pid, unsigned int flags) {  static char buf[PAGE_SIZE];  char *tmp = buf;  int i = 0;  int c;  if((short)dev == (short)-1) goto fail;  if(  link_name(tmp, major(dev), minor(dev), pid, "tty"   )) goto abbrev;  if(  link_name(tmp, major(dev), minor(dev), pid, "fd/2"  )) goto abbrev;  if( guess_name(tmp, major(dev), minor(dev)               )) goto abbrev;  if(  link_name(tmp, major(dev), minor(dev), pid, "fd/255")) goto abbrev;  if(driver_name(tmp, major(dev), minor(dev)               )) goto abbrev;fail:  strcpy(ret, "?");  return 1;abbrev:  if((flags&ABBREV_DEV) && !strncmp(tmp,"/dev/",5) && tmp[5]) tmp += 5;  if((flags&ABBREV_TTY) && !strncmp(tmp,"tty",  3) && tmp[3]) tmp += 3;  if((flags&ABBREV_PTS) && !strncmp(tmp,"pts/", 4) && tmp[4]) tmp += 4;  tmp[chop] = '\0';  for(;;){    c = *tmp;    tmp++;    if(!c) break;    i++;    if(c<=' ') c = '?';    if(c>126)  c = '?';    *ret = c;    ret++;  }  *ret = '\0';  return i;}