]> granicus.if.org Git - apache/commitdiff
parse content-length correctly using new apr_strtoff function
authorAndré Malo <nd@apache.org>
Tue, 25 May 2004 18:01:02 +0000 (18:01 +0000)
committerAndré Malo <nd@apache.org>
Tue, 25 May 2004 18:01:02 +0000 (18:01 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@103763 13f79535-47bb-0310-9956-ffa450edef68

modules/experimental/mod_cache.c

index 410fbb2499ed7fa0e0a3e7be100f50814b6e3a5a..f2bc9c5c0d064840921e725568898490f5b29c4c 100644 (file)
@@ -597,9 +597,13 @@ static int cache_in_filter(ap_filter_t *f, apr_bucket_brigade *in)
         cl = apr_table_get(r->headers_out, "Content-Length");
     }
     if (cl) {
-        size = apr_atoi64(cl);
+        char *errp;
+        if (apr_strtoff(&size, cl, &errp, 10) || *errp || size < 0) {
+            cl = NULL; /* parse error, see next 'if' block */
+        }
     }
-    else {
+
+    if (!cl) {
         /* if we don't get the content-length, see if we have all the 
          * buckets and use their length to calculate the size 
          */