Blame SOURCES/0015-NSS-Set-packet-length-for-initgroups.patch

2fc102
From 644f0b89c61b8a912514df550633f179c654240a Mon Sep 17 00:00:00 2001
2fc102
From: Lukas Slebodnik <lslebodn@redhat.com>
2fc102
Date: Tue, 5 Nov 2013 17:58:36 +0100
2fc102
Subject: [PATCH 15/15] NSS: Set packet length for initgroups
2fc102
2fc102
Some groups could be skipped, but packet length was not trimmed.
2fc102
This is a reason why valgrind reported access to uninitialised bytes.
2fc102
Actually, it isn't a problem, because the first uint32 in body is number of
2fc102
sended gids.
2fc102
2fc102
Resolves:
2fc102
https://fedorahosted.org/sssd/ticket/2138
2fc102
---
2fc102
 src/responder/nss/nsssrv_cmd.c | 7 +++++++
2fc102
 1 file changed, 7 insertions(+)
2fc102
2fc102
diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c
2fc102
index ada2b64df88d6a03a5c36a76076da447faa573c9..07f31188074bf45664969fb33388edb475e53b96 100644
2fc102
--- a/src/responder/nss/nsssrv_cmd.c
2fc102
+++ b/src/responder/nss/nsssrv_cmd.c
2fc102
@@ -3558,6 +3558,13 @@ static int fill_initgr(struct sss_packet *packet, struct ldb_result *res)
2fc102
 
2fc102
     ((uint32_t *)body)[0] = num-skipped; /* num results */
2fc102
     ((uint32_t *)body)[1] = 0; /* reserved */
2fc102
+    blen = (2 + bindex) * sizeof(uint32_t);
2fc102
+    ret = sss_packet_set_size(packet, blen);
2fc102
+    if (ret != EOK) {
2fc102
+        DEBUG(SSSDBG_OP_FAILURE,
2fc102
+              ("Could not set packet size to value:%zu\n", blen));
2fc102
+        return ret;
2fc102
+    }
2fc102
 
2fc102
     return EOK;
2fc102
 }
2fc102
-- 
2fc102
1.8.4.2
2fc102