]> git.ipfire.org Git - thirdparty/glibc.git/commit - ChangeLog
ptsname_r: don't leak uninitialized memory (BZ #16917)
authorAurelien Jarno <aurelien@aurel32.net>
Thu, 15 May 2014 22:03:37 +0000 (00:03 +0200)
committerAurelien Jarno <aurelien@aurel32.net>
Thu, 15 May 2014 22:07:29 +0000 (00:07 +0200)
commitd0583c403952630c534b0605ff7d69af5ec473cc
tree87b8ce3f6ac98870ceff9ec85e2b4fd1f3ec7641
parentc0c08d02c82275353f5c556f935a1a01714d9d7f
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>
ChangeLog
NEWS
login/Makefile
login/tst-ptsname.c [new file with mode: 0644]
sysdeps/unix/sysv/linux/ptsname.c