]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Clear errno before calling strtol
authorMark Andrews <marka@isc.org>
Wed, 4 Mar 2026 06:51:09 +0000 (17:51 +1100)
committerMark Andrews <marka@isc.org>
Mon, 16 Mar 2026 23:51:37 +0000 (10:51 +1100)
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.

lib/isc/httpd.c

index 13b3d55a63397c5ed7845d3507b6da2d278d95f5..910e15d00feb51f8747acd0e5b57536dcbf2e728 100644 (file)
@@ -419,9 +419,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) {