about summary refs log tree commit diff
path: root/nis/nss_nisplus/nisplus-publickey.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-11-12 21:27:41 +0000
committerUlrich Drepper <drepper@redhat.com>1999-11-12 21:27:41 +0000
commita680290af821a9f18df184edb438685f86150ab6 (patch)
treec8e6e6cc6ad75f5af34a4b536f49212a98de839c /nis/nss_nisplus/nisplus-publickey.c
parent7eafba908e3aaccaf8c9204d1404e3374b946567 (diff)
downloadglibc-a680290af821a9f18df184edb438685f86150ab6.tar.gz
glibc-a680290af821a9f18df184edb438685f86150ab6.tar.xz
glibc-a680290af821a9f18df184edb438685f86150ab6.zip
Update.
1999-11-12  Thorsten Kukuk  <kukuk@suse.de>

	* nis/nss_nisplus/nisplus-publickey.c: Check for snprintf return value.

	* sysdeps/unix/sysv/linux/alpha/sys/procfs.h: Follow changes from
	i386 version.
	* sysdeps/unix/sysv/linux/arm/sys/procfs.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/sys/procfs.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/sys/procfs.h: Likewise.
	* sysdeps/unix/sysv/linux/sys/procfs.h: Likewise.

	Closes PR libc/1438.
Diffstat (limited to 'nis/nss_nisplus/nisplus-publickey.c')
-rw-r--r--nis/nss_nisplus/nisplus-publickey.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/nis/nss_nisplus/nisplus-publickey.c b/nis/nss_nisplus/nisplus-publickey.c
index 1620611fbc..2aa494f078 100644
--- a/nis/nss_nisplus/nisplus-publickey.c
+++ b/nis/nss_nisplus/nisplus-publickey.c
@@ -1,6 +1,6 @@
-/* Copyright (c) 1997 Free Software Foundation, Inc.
+/* Copyright (c) 1997, 1999 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
+   Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public License as
@@ -59,6 +59,12 @@ _nss_nisplus_getpublickey (const char *netname, char *pkey, int *errnop)
 		   "[auth_name=%s,auth_type=DES],cred.org_dir.%s",
 		   netname, domain);
 
+  if (slen >= NIS_MAXNAMELEN)
+    {
+      *errnop = EINVAL;
+      return NSS_STATUS_UNAVAIL;
+    }
+
   if (buf[slen - 1] != '.')
     {
       buf[slen++] = '.';
@@ -131,6 +137,12 @@ _nss_nisplus_getsecretkey (const char *netname, char *skey, char *passwd,
 		   "[auth_name=%s,auth_type=DES],cred.org_dir.%s",
 		   netname, domain);
 
+  if (slen >= NIS_MAXNAMELEN)
+    {
+      *errnop = EINVAL;
+      return NSS_STATUS_UNAVAIL;
+    }
+
   if (buf[slen - 1] != '.')
     {
       buf[slen++] = '.';
@@ -216,7 +228,7 @@ _nss_nisplus_netname2user (char netname[MAXNETNAMELEN + 1], uid_t *uidp,
 {
   char *domain;
   nis_result *res;
-  char sname[NIS_MAXNAMELEN+1]; /*  search criteria + table name */
+  char sname[NIS_MAXNAMELEN+2]; /*  search criteria + table name */
   size_t slen;
   char principal[NIS_MAXNAMELEN+1];
   int len;
@@ -237,6 +249,12 @@ _nss_nisplus_netname2user (char netname[MAXNETNAMELEN + 1], uid_t *uidp,
 		   "[auth_name=%s,auth_type=DES],cred.org_dir.%s",
 		   netname, domain);
 
+  if (slen >= NIS_MAXNAMELEN)
+    {
+      *errnop = EINVAL;
+      return NSS_STATUS_UNAVAIL;
+    }
+
   if (sname[slen - 1] != '.')
     {
       sname[slen++] = '.';