From 0fb1e5c86502952a0843de4ab7d48da61668f8f9 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Wed, 4 Mar 2026 17:51:09 +1100 Subject: [PATCH] Clear errno before calling strtol The previous code was incorrectly clearing errno after calling strtol but before testing the result rather than clearing it and then calling strtol so that changes to errno can be correctly determined. (cherry picked from commit d3ffa1f0073899a96e478906fff5af31eba33784) --- lib/isc/httpd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/isc/httpd.c b/lib/isc/httpd.c index 18fecf1c6e..809cb30728 100644 --- a/lib/isc/httpd.c +++ b/lib/isc/httpd.c @@ -425,9 +425,8 @@ process_request(isc_httpd_t *httpd, size_t last_len) { if (name_match(header, "Content-Length")) { char *endptr; - long val = strtol(header->value, &endptr, 10); - errno = 0; + long val = strtol(header->value, &endptr, 10); /* ensure we consumed all digits */ if ((header->value + header->value_len) != endptr) {