From: Paul Eggert Date: Thu, 8 Aug 2024 23:38:28 +0000 (-0700) Subject: Fix minor integer overflow in xsparse.c X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=88c2aa1616aeaea8167e577b76468b9994f6391e;p=thirdparty%2Ftar.git Fix minor integer overflow in xsparse.c * scripts/xsparse.c (read_xheader): Don’t assume size_t fits in unsigned. Make the version numbers off_t, not just unsigned. --- diff --git a/scripts/xsparse.c b/scripts/xsparse.c index a6c36602..625b04d9 100644 --- a/scripts/xsparse.c +++ b/scripts/xsparse.c @@ -160,8 +160,8 @@ get_var (FILE *fp, char **name, char **value) static char *outname; static off_t outsize; -static unsigned int version_major; -static unsigned int version_minor; +static off_t version_major; +static off_t version_minor; static void read_xheader (char *name) @@ -190,11 +190,11 @@ read_xheader (char *name) } else if (strcmp (kw, "major") == 0) { - version_major = string_to_size (val, NULL, SIZE_MAX); + version_major = string_to_off (val, NULL); } else if (strcmp (kw, "minor") == 0) { - version_minor = string_to_size (val, NULL, SIZE_MAX); + version_minor = string_to_off (val, NULL); } else if (strcmp (kw, "realsize") == 0 || strcmp (kw, "size") == 0)