glibc/sysdeps
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
..
aarch64 Clean up __exit_thread. 2014-05-13 09:49:20 -07:00
alpha Clean up __exit_thread. 2014-05-13 09:49:20 -07:00
arm ARM: Improve fenv implementation 2014-05-15 15:23:27 +01:00
generic Clean up __exit_thread. 2014-05-13 09:49:20 -07:00
gnu Silence a missing-noreturn warning for _Unwind_Resume. 2014-05-09 10:06:20 -07:00
hppa Clean up __exit_thread. 2014-05-13 09:49:20 -07:00
i386 Move NPTL public ABI headers for x86 to sysdeps/x86/nptl/. 2014-05-14 09:44:56 -07:00
ia64 Clean up __exit_thread. 2014-05-13 09:49:20 -07:00
ieee754 Fix log1pl (LDBL_MAX) in FE_UPWARD mode (bug 16564). 2014-05-14 12:38:56 +00:00
init_array Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
m68k Clean up __exit_thread. 2014-05-13 09:49:20 -07:00
mach Some configure-related decrufting. 2014-05-08 11:27:14 -07:00
microblaze Clean up __exit_thread. 2014-05-13 09:49:20 -07:00
mips Clean up __exit_thread. 2014-05-13 09:49:20 -07:00
posix Return EAI_AGAIN for AF_UNSPEC when herrno is TRY_AGAIN (BZ #16849) 2014-05-15 12:33:11 +05:30
powerpc PowerPC: strncpy/stpncpy optimization for PPC64/POWER7 2014-05-06 09:54:25 -05:00
pthread Use glibc_likely instead __builtin_expect. 2014-02-10 15:07:12 +01:00
s390 S/390: Port of lock elision to System/z 2014-05-09 16:58:46 +02:00
sh Don't include individual test ulps in libm-test-ulps. 2014-03-05 15:02:38 +00:00
sparc Fix v9/64-bit strcmp when string ends in multiple zero bytes. 2014-05-01 12:15:06 -07:00
tile Clean up __exit_thread. 2014-05-13 09:49:20 -07:00
unix ptsname_r: don't leak uninitialized memory (BZ #16917) 2014-05-16 00:07:29 +02:00
wordsize-32 Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
wordsize-64 Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
x86 Move NPTL public ABI headers for x86 to sysdeps/x86/nptl/. 2014-05-14 09:44:56 -07:00
x86_64 Move NPTL public ABI headers for x86 to sysdeps/x86/nptl/. 2014-05-14 09:44:56 -07:00