glibc/login
Aurelien Jarno d0583c4039 ptsname_r: don't leak uninitialized memory (BZ #16917)
If the fd refers to a terminal device, but not a pty master, the
TIOCGPTN ioctl returns with ENOTTY. This error is not caught, and the
possibly undefined buffer passed to ptsname_r is sent directly to the
stat64 syscall.

Fix this by using a fallback to the old method only if the TIOCGPTN
ioctl fails with EINVAL. This also fix the return value in that specific
case (it return ENOENT without this patch).

Also add tests to the ptsname_r function (and ptsname at the same time).

Note: this is Debian bug#741482, reported by Jakub Wilk <jwilk@debian.org>
2014-05-16 00:07:29 +02:00
..
programs Use glibc_likely instead __builtin_expect. 2014-02-10 15:07:12 +01:00
endutxent.c
forkpty.c
getlogin_r_chk.c
getlogin_r.c
getlogin.c
getpt.c
getutent_r.c
getutent.c
getutid_r.c
getutid.c
getutline_r.c
getutline.c
getutmp.c
getutmpx.c
getutxent.c
getutxid.c
getutxline.c
grantpt.c
lastlog.h
login_tty.c
login.c
logout.c
logwtmp.c
Makefile ptsname_r: don't leak uninitialized memory (BZ #16917) 2014-05-16 00:07:29 +02:00
openpty.c
ptsname_r_chk.c
ptsname.c
pty.h
pututxline.c
setlogin.c
setutxent.c
tst-grantpt.c
tst-ptsname.c ptsname_r: don't leak uninitialized memory (BZ #16917) 2014-05-16 00:07:29 +02:00
tst-utmp.c
tst-utmpx.c
unlockpt.c
updwtmp.c
updwtmpx.c
utmp_file.c
utmp-private.h
utmp.h
utmpname.c
utmpxname.c
Versions