]> granicus.if.org Git - apache/commitdiff
It isn't valid to check errno without setting it first, unless an
authorRoy T. Fielding <fielding@apache.org>
Tue, 18 Jun 2002 00:14:21 +0000 (00:14 +0000)
committerRoy T. Fielding <fielding@apache.org>
Tue, 18 Jun 2002 00:14:21 +0000 (00:14 +0000)
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

index 20c0da994d9477221999ada66125d4ce02f7bc22..d8f18ccfc9f48a796e8d00bfca886093cb7af6ee 100644 (file)
@@ -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; 
             }
         }