]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
nss-systemd: make check-pointer-deref clean
authorMichael Vogt <michael@amutable.com>
Fri, 27 Mar 2026 10:20:20 +0000 (11:20 +0100)
committerMichael Vogt <michael@amutable.com>
Fri, 27 Mar 2026 10:24:49 +0000 (11:24 +0100)
Add the needed assert changes to make the code clean
for the new check-pointer-deref script.

meson.build
src/nss-systemd/nss-systemd.c
src/nss-systemd/userdb-glue.c

index 4f0ea8adbf1e72daf5352b2e29efeb167c6ffb9e..e6169ad052c2a462df9b16555077b82b91dc390c 100644 (file)
@@ -2984,7 +2984,6 @@ if spatch.found()
                 'src/libsystemd/',
                 'src/network/',
                 'src/nspawn/',
-                'src/nss-systemd/',
                 'src/shared/',
                 # libc/ has no assert() or systemd-headers so leave it
                 'src/libc/',
index 6ed97f31a68f9a7e025835e9e1d7c6b9385c805f..0689175a53c118cc9ae06049154bcc1fd45592fe 100644 (file)
@@ -149,6 +149,7 @@ static enum nss_status copy_synthesized_passwd(
 
         assert(dest);
         assert(src);
+        assert(errnop);
         assert(src->pw_name);
         assert(src->pw_passwd);
         assert(src->pw_gecos);
@@ -191,6 +192,7 @@ static enum nss_status copy_synthesized_spwd(
 
         assert(dest);
         assert(src);
+        assert(errnop);
         assert(src->sp_namp);
         assert(src->sp_pwdp);
 
@@ -223,6 +225,7 @@ static enum nss_status copy_synthesized_group(
 
         assert(dest);
         assert(src);
+        assert(errnop);
         assert(src->gr_name);
         assert(src->gr_passwd);
         assert(src->gr_mem);
@@ -259,6 +262,7 @@ static enum nss_status copy_synthesized_sgrp(
 
         assert(dest);
         assert(src);
+        assert(errnop);
         assert(src->sg_namp);
         assert(src->sg_passwd);
         assert(src->sg_adm);
index 1d5e311ce86530fcbafb910fe4636b7e00f7b65d..6f1bf1e2af5c3ce298783a18bec479d01c76fd5f 100644 (file)
@@ -415,6 +415,9 @@ enum nss_status userdb_getgrgid(
  * string vector strv and stores amount of pointers in n and total
  * length of all contained strings including NUL bytes in len. */
 static void nss_count_strv(char * const *strv, size_t *n, size_t *len) {
+        assert(n);
+        assert(len);
+
         STRV_FOREACH(str, strv) {
                 (*len) += sizeof(char*);  /* space for array entry */
                 (*len) += strlen(*str) + 1;