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