if (buflen < devptslen + &numbuf[sizeof (numbuf)] - p)
if (buflen < devptslen + (&numbuf[sizeof (numbuf)] - p))
__ptsname_r (int fd, char *buf, size_t buflen){  int save_errno = errno;  struct stat64 st;  int ptyno;  if (buf == NULL)    {      __set_errno (EINVAL);      return EINVAL;    }  if (!__isatty (fd))    {      __set_errno (ENOTTY);      return ENOTTY;    }#ifdef TIOCGPTN  if (__ioctl (fd, TIOCGPTN, &ptyno) == 0)    {      /* Buffer we use to print the number in.  For a maximum size for         `int' of 8 bytes we never need more than 20 digits.  */      char numbuf[21];      const char *devpts = _PATH_DEVPTS;      const size_t devptslen = strlen (_PATH_DEVPTS);      char *p;      numbuf[sizeof (numbuf) - 1] = '\0';      p = _itoa_word (ptyno, &numbuf[sizeof (numbuf) - 1], 10, 0);      if (buflen < devptslen + &numbuf[sizeof (numbuf)] - p)	{	  __set_errno (ERANGE);	  return ERANGE;	}      memcpy (__stpcpy (buf, devpts), p, &numbuf[sizeof (numbuf)] - p);    }  else if (errno == EINVAL)#endif    {      char *p;      if (buflen < strlen (_PATH_TTY) + 3)	{	  __set_errno (ERANGE);	  return ERANGE;	}      if (__fxstat64 (_STAT_VER, fd, &st) < 0)	return errno;      /* Check if FD really is a master pseudo terminal.  */      if (! MASTER_P (st.st_rdev))	{	  __set_errno (ENOTTY);	  return ENOTTY;	}      ptyno = minor (st.st_rdev);      /* This is for the old BSD pseudo terminals.  As of Linux         2.1.115 these are no longer supported.  */      if (major (st.st_rdev) == 4)	ptyno -= 128;      if (ptyno / 16 >= strlen (__libc_ptyname1))	{	  __set_errno (ENOTTY);	  return ENOTTY;	}      p = __stpcpy (buf, _PATH_TTY);      p[0] = __libc_ptyname1[ptyno / 16];      p[1] = __libc_ptyname2[ptyno % 16];      p[2] = '\0';    }  if (__xstat64 (_STAT_VER, buf, &st) < 0)    return errno;  /* Check if the name we're about to return really corresponds to a     slave pseudo terminal.  */  if (! S_ISCHR (st.st_mode) || ! SLAVE_P (st.st_rdev))    {      /* This really is a configuration problem.  */      __set_errno (ENOTTY);      return ENOTTY;    }  __set_errno (save_errno);  return 0;}