]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/nss-systemd/nss-systemd.c
nss-systemd: fix alignment of gr_mem
[thirdparty/systemd.git] / src / nss-systemd / nss-systemd.c
index 7aea3652c41abea17ab957a2b3acbfc0c41fd0df..36486b96e397b358b454675475abf0b2a73c4514 100644 (file)
@@ -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;