summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-05-24 04:07:18 +0000
committerUlrich Drepper <drepper@redhat.com>2006-05-24 04:07:18 +0000
commit2d571cd1258ab7c20a49e802e31870041dc10a56 (patch)
treeb211f02b858e06c3efe20a7708fe162c9df3d33c
parenta17fa6100dd400cd0c64aab1803c2047c95bfd5b (diff)
downloadglibc-2d571cd1258ab7c20a49e802e31870041dc10a56.tar.gz
glibc-2d571cd1258ab7c20a49e802e31870041dc10a56.tar.xz
glibc-2d571cd1258ab7c20a49e802e31870041dc10a56.zip
* nis/nis_domain_of_r.c (nis_domain_of_r): Add missing buffer
	overflow test.
-rw-r--r--ChangeLog5
-rw-r--r--nis/libnsl.h1
-rw-r--r--nis/nis_call.c4
-rw-r--r--nis/nis_domain_of_r.c9
-rw-r--r--nis/nis_intern.h3
5 files changed, 19 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 52a54eaec4..518f2cafec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-05-23  Ulrich Drepper  <drepper@redhat.com>
+
+	* nis/nis_domain_of_r.c (nis_domain_of_r): Add missing buffer
+	overflow test.
+
 2006-05-20  Ulrich Drepper  <drepper@redhat.com>
 
 	* nis/nis_call.c (__prepare_niscall): New function.  Split out
diff --git a/nis/libnsl.h b/nis/libnsl.h
index eace582f85..c6ceb321d7 100644
--- a/nis/libnsl.h
+++ b/nis/libnsl.h
@@ -29,6 +29,7 @@ extern int _nsl_default_nss (void);
 /* Set up everything for a call to __do_niscall3.  */
 extern nis_error __prepare_niscall (const_nis_name name, directory_obj **dirp,
 				    dir_binding *bptrp, unsigned int flags);
+libnsl_hidden_proto (__prepare_niscall)
 
 extern struct ib_request *__create_ib_request (const_nis_name name,
 					       unsigned int flags);
diff --git a/nis/nis_call.c b/nis/nis_call.c
index bd6bcc50ab..9769f68174 100644
--- a/nis/nis_call.c
+++ b/nis/nis_call.c
@@ -30,6 +30,7 @@
 
 #include "nis_xdr.h"
 #include "nis_intern.h"
+#include <libnsl.h>
 
 static const struct timeval RPCTIMEOUT = {10, 0};
 static const struct timeval UDPTIMEOUT = {5, 0};
@@ -293,6 +294,8 @@ __do_niscall3 (dir_binding *dbp, u_long prog, xdrproc_t xargs, caddr_t req,
 
   return retcode;
 }
+libnsl_hidden_def (__do_niscall3)
+
 
 nis_error
 __do_niscall2 (const nis_server *server, u_int server_len, u_long prog,
@@ -573,6 +576,7 @@ __prepare_niscall (const_nis_name name, directory_obj **dirp,
 
   return retcode;
 }
+libnsl_hidden_def (__prepare_niscall)
 
 
 nis_error
diff --git a/nis/nis_domain_of_r.c b/nis/nis_domain_of_r.c
index 1fedcfe074..e2db146038 100644
--- a/nis/nis_domain_of_r.c
+++ b/nis/nis_domain_of_r.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997, 2004 Free Software Foundation, Inc.
+/* Copyright (c) 1997, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
 
@@ -29,6 +29,7 @@ nis_domain_of_r (const_nis_name name, char *buffer, size_t buflen)
 
   if (buffer == NULL)
     {
+    erange:
       __set_errno (ERANGE);
       return NULL;
     }
@@ -44,7 +45,11 @@ nis_domain_of_r (const_nis_name name, char *buffer, size_t buflen)
   cptr_len = strlen (cptr);
 
   if (cptr_len == 0)
-    return strcpy (buffer, ".");
+    {
+      if (buflen < 2)
+	goto erange;
+      return strcpy (buffer, ".");
+    }
 
   if (__builtin_expect (cptr_len >= buflen, 0))
     {
diff --git a/nis/nis_intern.h b/nis/nis_intern.h
index 29a80a9188..c805920aec 100644
--- a/nis/nis_intern.h
+++ b/nis/nis_intern.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (c) 1997,1998,1999,2000,2001,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
 
@@ -66,6 +66,7 @@ extern nis_error __do_niscall3 (dir_binding *dbp, u_long prog,
 				xdrproc_t xargs, caddr_t req,
 				xdrproc_t xres, caddr_t resp,
 				unsigned int flags, nis_cb *cb);
+libnsl_hidden_proto (__do_niscall3)
 
 extern u_short __pmap_getnisport (struct sockaddr_in *address, u_long program,
 				  u_long version, u_int protocol);