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 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_r_chk.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.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_r.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
getutid_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
getutline_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
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
login_tty.c
login.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10: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
Makefile ptsname_r: don't leak uninitialized memory (BZ #16917) 2014-05-16 00:07:29 +02:00
openpty.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
ptsname.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
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
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_file.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
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
Versions Move getlogin_r_chk to login/ subdir. 2013-05-06 15:58:44 -07:00