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
Makefile ptsname_r: don't leak uninitialized memory (BZ #16917) 2014-05-16 00:07:29 +02:00
Versions Move getlogin_r_chk to login/ subdir. 2013-05-06 15:58:44 -07:00
endutxent.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
forkpty.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
getlogin.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
getlogin_r.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
getlogin_r_chk.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
getpt.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
getutent.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
getutent_r.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
getutid.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
getutid_r.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
getutline.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
getutline_r.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
getutmp.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
getutmpx.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
getutxent.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
getutxid.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
getutxline.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
grantpt.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
lastlog.h Update. 1997-06-21 02:59:26 +00:00
login.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
login_tty.c * login/login_tty.c (login_tty): The Linux kernel can return EBUSY 2007-10-04 21:54:22 +00:00
logout.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
logwtmp.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
openpty.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
ptsname.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
ptsname_r_chk.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
pty.h Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
pututxline.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
setlogin.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
setutxent.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
tst-grantpt.c * login/tst-grantpt.c (test_einval): Add 3rd argument to open. 2007-08-17 06:28:40 +00:00
tst-ptsname.c ptsname_r: don't leak uninitialized memory (BZ #16917) 2014-05-16 00:07:29 +02:00
tst-utmp.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
tst-utmpx.c Update. 1998-06-02 12:58:14 +00:00
unlockpt.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
updwtmp.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
updwtmpx.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
utmp-private.h Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
utmp.h Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
utmp_file.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
utmpname.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
utmpxname.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00