about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJoe Landers <jlanders@vmware.com>2009-10-29 19:59:59 -0700
committerUlrich Drepper <drepper@redhat.com>2009-10-29 19:59:59 -0700
commitc240c3a58f21d72982e74a485bd7c4900f188876 (patch)
tree9fdc0318b9e6d1ee82df50901d1cac71606c5244
parent1a9e411e2aba14573ddc2ced4a5ee927a01031e0 (diff)
downloadglibc-c240c3a58f21d72982e74a485bd7c4900f188876.tar.gz
glibc-c240c3a58f21d72982e74a485bd7c4900f188876.tar.xz
glibc-c240c3a58f21d72982e74a485bd7c4900f188876.zip
Fix error handling in NIS.
A buffer was freed even though it wasn't allocated as expected.  Do
this only when !batch_read.
-rw-r--r--ChangeLog4
-rw-r--r--nis/nss_nis/nis-grp.c3
2 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 81defae3f5..d2089f5e2c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2009-10-29  Ulrich Drepper  <drepper@redhat.com>
 
+	[BZ #10692]
+	* nis/nss_nis/nis-grp.c (internal_nis_getgrent_r): Don't free buffer
+	in error if batch_read.  Patch by Joe Landers <jlanders@vmware.com>.
+
 	[BZ #10713]
 	* nis/nss_nis/nis-grp.c (internal_nis_endgrent): Start freeing blocks
 	from intern.start.  Patch by Joe Landers <jlanders@vmware.com>.
diff --git a/nis/nss_nis/nis-grp.c b/nis/nss_nis/nis-grp.c
index 071d8a2a55..6ad30eb1bb 100644
--- a/nis/nss_nis/nis-grp.c
+++ b/nis/nss_nis/nis-grp.c
@@ -204,7 +204,8 @@ internal_nis_getgrent_r (struct group *grp, char *buffer, size_t buflen,
 
       if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
 	{
-	  free (result);
+	  if (!batch_read)
+	    free (result);
 	  *errnop = ERANGE;
 	  return NSS_STATUS_TRYAGAIN;
 	}