From ac12de7e0343efdac0d0aa42e982b1b84dbd6124 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 6 Jul 2021 16:07:15 +0200 Subject: Clear errno before calling strto*() functions --- libbuild2/utility.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/libbuild2/utility.cxx b/libbuild2/utility.cxx index 193610f..f7f3d41 100644 --- a/libbuild2/utility.cxx +++ b/libbuild2/utility.cxx @@ -603,6 +603,7 @@ namespace build2 { const char* b (s.c_str ()); char* e (nullptr); + errno = 0; // We must clear it according to POSIX. uint64_t v (strtoull (b, &e, 10)); // Can't throw. if (errno != ERANGE && e == b + s.size () && v <= max_num) -- cgit v1.1