summaryrefslogtreecommitdiffstats
path: root/src/responder/nss/nsssrv_netgroup.c
diff options
context:
space:
mode:
authorMichal Zidek <mzidek@redhat.com>2013-08-28 12:46:58 +0200
committerJakub Hrozek <jhrozek@redhat.com>2014-02-05 14:41:38 +0100
commitd8057ec487e452038f0106042021fa612bbb8555 (patch)
tree18a64c53087b928ef0bbb03820077be40117ab6e /src/responder/nss/nsssrv_netgroup.c
parent8263ecef6f5c6dab802fdabaf57c25fd2fcf692e (diff)
downloadsssd-d8057ec487e452038f0106042021fa612bbb8555.tar.gz
sssd-d8057ec487e452038f0106042021fa612bbb8555.tar.xz
sssd-d8057ec487e452038f0106042021fa612bbb8555.zip
responder: Use SAFEALIGN macros where appropriate.
https://fedorahosted.org/sssd/ticket/1359
Diffstat (limited to 'src/responder/nss/nsssrv_netgroup.c')
-rw-r--r--src/responder/nss/nsssrv_netgroup.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/responder/nss/nsssrv_netgroup.c b/src/responder/nss/nsssrv_netgroup.c
index 3fc4b6431..0028a8878 100644
--- a/src/responder/nss/nsssrv_netgroup.c
+++ b/src/responder/nss/nsssrv_netgroup.c
@@ -680,8 +680,12 @@ static void nss_cmd_setnetgrent_done(struct tevent_req *req)
}
sss_packet_get_body(packet, &body, &blen);
- ((uint32_t *)body)[0] = 1; /* Got some results */
- ((uint32_t *)body)[1] = 0; /* reserved */
+
+ /* Got some results. */
+ SAFEALIGN_SETMEM_UINT32(body, 1, NULL);
+
+ /* reserved */
+ SAFEALIGN_SETMEM_UINT32(body + sizeof(uint32_t), 0, NULL);
}
sss_cmd_done(cmdctx->cctx, cmdctx);
@@ -842,7 +846,7 @@ static errno_t nss_cmd_getnetgrent_process(struct nss_cmd_ctx *cmdctx,
if (blen != sizeof(uint32_t)) {
return EINVAL;
}
- num = *((uint32_t *)body);
+ SAFEALIGN_COPY_UINT32(&num, body, NULL);
/* create response packet */
ret = sss_packet_new(client->creq, 0,
@@ -981,8 +985,12 @@ static errno_t nss_cmd_retnetgrent(struct cli_ctx *client,
}
sss_packet_get_body(packet, &body, &blen);
- ((uint32_t *)body)[0] = num; /* num results */
- ((uint32_t *)body)[1] = 0; /* reserved */
+
+ /* num results */
+ SAFEALIGN_COPY_UINT32(body, &num, NULL);
+
+ /* reserved */
+ SAFEALIGN_SETMEM_UINT32(body + sizeof(uint32_t), 0, NULL);
return EOK;
}