olga / rpms / glibc

Forked from rpms/glibc 5 years ago
Clone
ce426f
commit c44496df2f090a56d3bf75df930592dac6bba46f
ce426f
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
ce426f
Date:   Wed Mar 12 17:27:22 2014 +0530
ce426f
ce426f
    Provide correct buffer length to netgroup queries in nscd (BZ #16695)
ce426f
    
ce426f
    The buffer to query netgroup entries is allocated sufficient space for
ce426f
    the netgroup entries and the key to be appended at the end, but it
ce426f
    sends in an incorrect available length to the NSS netgroup query
ce426f
    functions, resulting in overflow of the buffer in some special cases.
ce426f
    The fix here is to factor in the key length when sending the available
ce426f
    buffer and buffer length to the query functions.
ce426f
ce426f
diff --git glibc-2.17-c758a686/nscd/netgroupcache.c glibc-2.17-c758a686/nscd/netgroupcache.c
ce426f
index 426d3c5..5ba1e1f 100644
ce426f
--- glibc-2.17-c758a686/nscd/netgroupcache.c
ce426f
+++ glibc-2.17-c758a686/nscd/netgroupcache.c
ce426f
@@ -202,7 +202,7 @@ addgetnetgrentX (struct database_dyn *db, int fd, request_header *req,
ce426f
 		  {
ce426f
 		    int e;
ce426f
 		    status = getfct.f (&data, buffer + buffilled,
ce426f
-				       buflen - buffilled, &e);
ce426f
+				       buflen - buffilled - req->key_len, &e);
ce426f
 		    if (status == NSS_STATUS_RETURN
ce426f
 			|| status == NSS_STATUS_NOTFOUND)
ce426f
 		      /* This was either the last one for this group or the