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.
This commit is contained in:
Mark Andrews 2026-03-04 17:51:09 +11:00
parent 5932af66c8
commit d3ffa1f007

View 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) {