summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/responder/autofs/autofssrv_cmd.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/responder/autofs/autofssrv_cmd.c b/src/responder/autofs/autofssrv_cmd.c
index 8a79cecf3..629465438 100644
--- a/src/responder/autofs/autofssrv_cmd.c
+++ b/src/responder/autofs/autofssrv_cmd.c
@@ -1085,13 +1085,13 @@ getautomntent_process(struct autofs_cmd_ctx *cmdctx,
goto done;
}
+ /* allocate memory for number of entries in the packet */
ret = sss_packet_grow(client->creq->out, sizeof(uint32_t));
if (ret != EOK) {
DEBUG(SSSDBG_OP_FAILURE, ("Cannot grow packet\n"));
goto done;
}
- sss_packet_get_body(client->creq->out, &body, &blen);
rp = sizeof(uint32_t); /* We'll write the number of entries here */
left = map->entry_count - cursor;
@@ -1111,6 +1111,10 @@ getautomntent_process(struct autofs_cmd_ctx *cmdctx,
nentries++;
}
+ /* packet grows in fill_autofs_entry, body pointer may change,
+ * thus we have to obtain it here */
+ sss_packet_get_body(client->creq->out, &body, &blen);
+
rp = 0;
SAFEALIGN_SET_UINT32(&body[rp], nentries, &rp);