summaryrefslogtreecommitdiffstats
path: root/src/nss-systemd
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-12-30 22:59:42 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2021-12-31 01:05:16 +0100
commit420a35c1fadfb4d67be6316436233d98b5688de5 (patch)
treea8024415d93c7bd12f1e2a641c4bc739d2841172 /src/nss-systemd
parentMerge pull request #21940 from yuwata/network-wireguard-mask-allowed-ips (diff)
downloadsystemd-420a35c1fadfb4d67be6316436233d98b5688de5.tar.xz
systemd-420a35c1fadfb4d67be6316436233d98b5688de5.zip
nss-systemd: fix alignment of gr_mem
Follow-up for 1e65eb8f9b7d567462030b2e625998d77677e636. Fixes #21935.
Diffstat (limited to 'src/nss-systemd')
-rw-r--r--src/nss-systemd/nss-systemd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nss-systemd/nss-systemd.c b/src/nss-systemd/nss-systemd.c
index 7aea3652c4..36486b96e3 100644
--- a/src/nss-systemd/nss-systemd.c
+++ b/src/nss-systemd/nss-systemd.c
@@ -238,7 +238,7 @@ static enum nss_status copy_synthesized_group(
required += strlen(src->gr_passwd) + 1;
required += sizeof(char*); /* ...but that NULL still needs to be stored into the buffer! */
- if (buflen < required) {
+ if (buflen < ALIGN(required)) {
*errnop = ERANGE;
return NSS_STATUS_TRYAGAIN;
}
@@ -250,7 +250,7 @@ static enum nss_status copy_synthesized_group(
/* String fields point into the user-provided buffer */
dest->gr_name = buffer;
dest->gr_passwd = stpcpy(dest->gr_name, src->gr_name) + 1;
- dest->gr_mem = (char **) stpcpy(dest->gr_passwd, src->gr_passwd) + 1;
+ dest->gr_mem = ALIGN_PTR(stpcpy(dest->gr_passwd, src->gr_passwd) + 1);
*dest->gr_mem = NULL;
return NSS_STATUS_SUCCESS;