:: commit 62bee983c5ae9e675bd46cd5dced12ccaa532b5d

Mintsuki <mintsuki@protonmail.com> — 2026-02-07 08:18

parents: 129fc506ce

lib/misc: Reject digits >= base in strtoui()

diff --git a/common/lib/misc.s2.c b/common/lib/misc.s2.c
index 61847198..78cdb881 100644
--- a/common/lib/misc.s2.c
+++ b/common/lib/misc.s2.c
@@ -33,7 +33,7 @@ uint64_t strtoui(const char *s, const char **end, int base) {
     uint64_t n = 0;
     for (size_t i = 0; ; i++) {
         int d = digit_to_int(s[i]);
-        if (d == -1) {
+        if (d == -1 || d >= base) {
             if (end != NULL)
                 *end = &s[i];
             break;
tab: 248 wrap: offon