summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Slebodnik <lslebodn@redhat.com>2013-11-05 17:58:36 +0100
committerJakub Hrozek <jhrozek@redhat.com>2013-11-07 11:23:24 +0100
commit66fa032b86f730315b30d62ed58ab17ad065e5ff (patch)
tree4f2ef04d026f1bf884a6559752a195cf467fb96f
parent6469f42ca80bb9b955875d590485b0d9366491df (diff)
downloadsssd-66fa032b86f730315b30d62ed58ab17ad065e5ff.tar.gz
sssd-66fa032b86f730315b30d62ed58ab17ad065e5ff.tar.xz
sssd-66fa032b86f730315b30d62ed58ab17ad065e5ff.zip
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
-rw-r--r--src/responder/nss/nsssrv_cmd.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c
index 715c27ba0..99213ee27 100644
--- a/src/responder/nss/nsssrv_cmd.c
+++ b/src/responder/nss/nsssrv_cmd.c
@@ -3559,6 +3559,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;
}