]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
pe-binary: add explicit cast to silence coverity
authorLuca Boccassi <luca.boccassi@gmail.com>
Sat, 28 Mar 2026 18:45:52 +0000 (18:45 +0000)
committerLuca Boccassi <luca.boccassi@gmail.com>
Sat, 28 Mar 2026 19:56:31 +0000 (19:56 +0000)
Otherwise it gets confused about underflows (which are already checked)

CID#1645068

Follow-up for a43427013949c6593629f551cf46e9cf9c167100

src/shared/pe-binary.c

index 98b758dc4ebda23d4f1630122e8c0b8415f99778..da54428306c116f22c04a0f3086aabbfbb348c90 100644 (file)
@@ -423,7 +423,7 @@ int pe_hash(int fd,
                 if ((uint64_t) st.st_size - p < le32toh(certificate_table->Size))
                         return log_debug_errno(SYNTHETIC_ERRNO(EBADMSG), "No space for certificate table, refusing.");
 
-                r = hash_file(fd, mdctx, p, st.st_size - p - le32toh(certificate_table->Size));
+                r = hash_file(fd, mdctx, p, (uint64_t) st.st_size - p - le32toh(certificate_table->Size));
                 if (r < 0)
                         return r;