From: Zbigniew Jędrzejewski-Szmek Date: Mon, 4 Mar 2019 14:42:58 +0000 (+0100) Subject: sd-hwdb: fix off_t vs. size_t confusion in cast X-Git-Tag: v242-rc1~204^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=756479043de59fdad988598f20d06e78b7da75ab;p=thirdparty%2Fsystemd.git sd-hwdb: fix off_t vs. size_t confusion in cast > on 32bit, size_t is 32bit, but .st_size is off_t hence 64bit --- diff --git a/src/libsystemd/sd-hwdb/sd-hwdb.c b/src/libsystemd/sd-hwdb/sd-hwdb.c index 64aaf014545..d8c37c3fd47 100644 --- a/src/libsystemd/sd-hwdb/sd-hwdb.c +++ b/src/libsystemd/sd-hwdb/sd-hwdb.c @@ -333,7 +333,7 @@ _public_ int sd_hwdb_new(sd_hwdb **ret) { if (fstat(fileno(hwdb->f), &hwdb->st) < 0) return log_debug_errno(errno, "Failed to stat %s: %m", hwdb_bin_path); - if ((size_t) hwdb->st.st_size < offsetof(struct trie_header_f, strings_len) + 8) + if (hwdb->st.st_size < (off_t) offsetof(struct trie_header_f, strings_len) + 8) return log_debug_errno(SYNTHETIC_ERRNO(EIO), "File %s is too short: %m", hwdb_bin_path);