From de2a06183ebea42e27431d5dd94e108ac56e7436 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Mon, 14 May 2012 15:53:18 +0200 Subject: NSS: keep a pointer to body after body is reallocated --- src/responder/nss/nsssrv_cmd.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/responder/nss/nsssrv_cmd.c') diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c index f36a9a32..43e82ae3 100644 --- a/src/responder/nss/nsssrv_cmd.c +++ b/src/responder/nss/nsssrv_cmd.c @@ -1919,6 +1919,9 @@ static int fill_grent(struct sss_packet *packet, num++; if (gr_mmap_cache) { + /* body was reallocated, so fullname might be pointing to + * where body used to be, not where it is */ + to_sized_string(&fullname, (const char *)&body[rzero+STRS_ROFFSET]); ret = sss_mmap_cache_gr_store(nctx->grp_mc_ctx, &fullname, &pwfield, gid, memnum, (char *)&body[rzero] + STRS_ROFFSET + -- cgit