nss-systemd: make check-pointer-deref clean

Add the needed assert changes to make the code clean
for the new check-pointer-deref script.
This commit is contained in:
Michael Vogt
2026-03-27 11:24:49 +01:00
parent 39ef41e388
commit f124464b45
3 changed files with 7 additions and 1 deletions
-1
View 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/',
+4
View 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);
+3
View 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;