From: Mark Andrews Date: Wed, 4 Mar 2026 06:51:09 +0000 (+1100) Subject: Clear errno before calling strtol X-Git-Tag: v9.20.22~24^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0fb1e5c86502952a0843de4ab7d48da61668f8f9;p=thirdparty%2Fbind9.git 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) --- diff --git a/lib/isc/httpd.c b/lib/isc/httpd.c index 18fecf1c6e8..809cb307283 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) {