]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
cksum: fix --length validation on 32 bit platforms
authorPádraig Brady <P@draigBrady.com>
Thu, 16 Apr 2026 19:37:28 +0000 (20:37 +0100)
committerPádraig Brady <P@draigBrady.com>
Thu, 16 Apr 2026 19:40:34 +0000 (20:40 +0100)
Fix an unreleased issue due to the recent change
to using idx_t in commit v9.10-91-g02983e493

* src/cksum.c (main): Limit the possible return to
the range supported by idx_t.
Reported by Bruno Haible.

src/cksum.c

index 79310a0d92b4c93b5b1c976cf536d3edf9a419a7..3a59e45ca42697ceb57a181978713b5137b86b4a 100644 (file)
@@ -1626,7 +1626,7 @@ main (int argc, char **argv)
 #endif
 #if HASH_ALGO_BLAKE2 || HASH_ALGO_CKSUM
       case 'l':
-        digest_length = xnumtoimax (optarg, 10, 0, INTMAX_MAX, "",
+        digest_length = xnumtoimax (optarg, 10, 0, IDX_MAX, "",
                                     _("invalid length"), 0,
                                     XTOINT_MAX_QUIET);
         digest_length_str = optarg;