From: Lennart Poettering Date: Wed, 21 Jan 2026 22:48:29 +0000 (+0100) Subject: journal: do not use typecasts for range checks X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1efc26343307c4fcdeb383e25b17a8494493b273;p=thirdparty%2Fsystemd.git journal: do not use typecasts for range checks --- diff --git a/src/libsystemd/sd-journal/journal-file.c b/src/libsystemd/sd-journal/journal-file.c index 8dcd599bbda..de5d7075e0c 100644 --- a/src/libsystemd/sd-journal/journal-file.c +++ b/src/libsystemd/sd-journal/journal-file.c @@ -1940,8 +1940,10 @@ static int maybe_decompress_payload( assert(f); /* We can't read objects larger than 4G on a 32-bit machine */ - if ((uint64_t) (size_t) size != size) +#if __SIZEOF_SIZE_T__ == 4 + if (size > UINT32_MAX) return -E2BIG; +#endif if (compression != COMPRESSION_NONE) { #if HAVE_COMPRESSION