From: Roy T. Fielding Date: Tue, 18 Jun 2002 00:14:21 +0000 (+0000) Subject: It isn't valid to check errno without setting it first, unless an X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bad599ee2a3903f81c4572e1fa44c71d10f2b8d5;p=thirdparty%2Fapache%2Fhttpd.git It isn't valid to check errno without setting it first, unless an error return value already indicated that errno was set. Also, we might as well accept any error or junk remaining in the field as a parse error. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95743 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index 20c0da994d9..d8f18ccfc9f 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -803,10 +803,12 @@ apr_status_t ap_http_filter(ap_filter_t *f, apr_bucket_brigade *b, if (*pos == '\0') { char *endstr; + + errno = 0; ctx->state = BODY_LENGTH; ctx->remaining = strtol(lenp, &endstr, 10); - if (errno == ERANGE) { + if (errno || (endstr && *endstr)) { conversion_error = 1; } } @@ -1714,9 +1716,11 @@ AP_DECLARE(int) ap_setup_client_block(request_rec *r, int read_policy) if (*pos == '\0') { char *endstr; + + errno = 0; r->remaining = strtol(lenp, &endstr, 10); - if (errno == ERANGE || errno == EINVAL) { + if (errno || (endstr && *endstr)) { conversion_error = 1; } }