From bad599ee2a3903f81c4572e1fa44c71d10f2b8d5 Mon Sep 17 00:00:00 2001 From: "Roy T. Fielding" Date: Tue, 18 Jun 2002 00:14:21 +0000 Subject: [PATCH] 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 --- modules/http/http_protocol.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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; } } -- 2.50.1