From: Michael Vogt Date: Fri, 27 Mar 2026 10:30:32 +0000 (+0100) Subject: import: make check-pointer-deref clean X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=44b2d1e1557fdded45b57ac0d431d1ea8d4cdbe1;p=thirdparty%2Fsystemd.git import: make check-pointer-deref clean Add the needed assert changes to make the code clean for the new check-pointer-deref script. --- diff --git a/meson.build b/meson.build index e6169ad052c..5c02ab86640 100644 --- a/meson.build +++ b/meson.build @@ -2979,7 +2979,6 @@ if spatch.found() coccinelle_exclude = [ 'src/basic/', 'src/core/', - 'src/import/', 'src/journal/', 'src/libsystemd/', 'src/network/', diff --git a/src/import/curl-util.c b/src/import/curl-util.c index 4747d0993a8..bddc93d52b8 100644 --- a/src/import/curl-util.c +++ b/src/import/curl-util.c @@ -359,6 +359,8 @@ int curl_header_strdup(const void *contents, size_t sz, const char *field, char const char *p; char *s; + assert(value); + p = memory_startswith_no_case(contents, sz, field); if (!p) return 0; diff --git a/src/import/import-compress.c b/src/import/import-compress.c index f893abc43e6..aca4041f2a4 100644 --- a/src/import/import-compress.c +++ b/src/import/import-compress.c @@ -318,6 +318,10 @@ static int enlarge_buffer(void **buffer, size_t *buffer_size, size_t *buffer_all size_t l; void *p; + assert(buffer); + assert(buffer_size); + assert(buffer_allocated); + if (*buffer_allocated > *buffer_size) return 0; diff --git a/src/import/pull-common.c b/src/import/pull-common.c index cc06fe4f1db..c0e0e9907e6 100644 --- a/src/import/pull-common.c +++ b/src/import/pull-common.c @@ -622,6 +622,7 @@ int pull_job_restart_with_sha256sum(PullJob *j, char **ret) { int r; assert(j); + assert(ret); /* Generic implementation of a PullJobNotFound handler, that restarts the job requesting SHA256SUMS */ diff --git a/src/import/qcow2-util.c b/src/import/qcow2-util.c index 77298bcbe29..dd5c3c23ecb 100644 --- a/src/import/qcow2-util.c +++ b/src/import/qcow2-util.c @@ -150,6 +150,10 @@ static int normalize_offset( bool *compressed, uint64_t *compressed_size) { + assert(ret); + POINTER_MAY_BE_NULL(compressed); + POINTER_MAY_BE_NULL(compressed_size); + uint64_t q; q = be64toh(p);