From 4cebad3859f8cc4fe526a89ef2277d1db9ee9b7c Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 6 Jul 2021 16:06:23 +0200 Subject: Clear errno before calling strto*() functions --- libbutl/standard-version.cxx | 1 + 1 file changed, 1 insertion(+) (limited to 'libbutl/standard-version.cxx') diff --git a/libbutl/standard-version.cxx b/libbutl/standard-version.cxx index a9f5eb8..863cb29 100644 --- a/libbutl/standard-version.cxx +++ b/libbutl/standard-version.cxx @@ -60,6 +60,7 @@ namespace butl const char* b (s.c_str () + p); 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 || b == e || v < min || v > max) -- cgit v1.1