about summary refs log tree commit diff
path: root/login
diff options
context:
space:
mode:
Diffstat (limited to 'login')
-rw-r--r--login/Makefile3
-rw-r--r--login/Versions3
-rw-r--r--login/ptsname_r_chk.c28
3 files changed, 33 insertions, 1 deletions
diff --git a/login/Makefile b/login/Makefile
index 4b057ec927..fa5aa71381 100644
--- a/login/Makefile
+++ b/login/Makefile
@@ -25,7 +25,8 @@ headers	:= utmp.h bits/utmp.h lastlog.h pty.h
 
 routines := getlogin getlogin_r setlogin \
 	    getutent getutent_r getutid getutline getutid_r getutline_r \
-	    utmp_file utmpname updwtmp getpt grantpt unlockpt ptsname
+	    utmp_file utmpname updwtmp getpt grantpt unlockpt ptsname \
+	    ptsname_r_chk
 
 CFLAGS-grantpt.c = -DLIBEXECDIR='"$(libexecdir)"'
 
diff --git a/login/Versions b/login/Versions
index 0c9e75a7ef..f4df7183d5 100644
--- a/login/Versions
+++ b/login/Versions
@@ -41,6 +41,9 @@ libc {
     # p*
     posix_openpt;
   }
+  GLIBC_2.4 {
+    __ptsname_r_chk;
+  }
 }
 
 libutil {
diff --git a/login/ptsname_r_chk.c b/login/ptsname_r_chk.c
new file mode 100644
index 0000000000..7e039acb74
--- /dev/null
+++ b/login/ptsname_r_chk.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 2005-2013 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <stdlib.h>
+
+
+int
+__ptsname_r_chk (int fd, char *buf, size_t buflen, size_t nreal)
+{
+  if (buflen > nreal)
+    __chk_fail ();
+
+  return __ptsname_r (fd, buf, buflen);
+}