From 7e65c1fb80ee9c3401873b11017e2b9037f6c767 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Mon, 7 Jul 2025 20:46:45 -0500 Subject: [PATCH] Exclude octal from atolx(), just detect hex and decimal. --- lib/lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/lib.c b/lib/lib.c index 1183435b..7ae3ff66 100644 --- a/lib/lib.c +++ b/lib/lib.c @@ -312,7 +312,8 @@ long long atolx(char *numstr) char *c = numstr, *suffixes="cwbkmgtpe", *end; long long val; - val = xstrtol(numstr, &c, 0); + // exclude octal to avoid confusion + val = xstrtol(numstr, &c, strstr(numstr, "0x") ? 0 : 10); if (c != numstr && *c && (end = strchr(suffixes, tolower(*c)))) { int shift = end-suffixes-2; ++c; -- 2.39.5