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-Tag: 2.0.40~449 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6753f543441092fe7d53bfbe52ae438a5524d935;p=apache 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 20c0da994d..d8f18ccfc9 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; } }