httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n.@apache.org
Subject cvs commit: httpd-2.0/modules/dav/main mod_dav.c
Date Tue, 25 May 2004 17:13:07 GMT
nd          2004/05/25 10:13:07

  Modified:    modules/dav/main mod_dav.c
  Log:
  use new apr_strtoff function to parse PUT ranges correctly.
  
  Revision  Changes    Path
  1.108     +18 -6     httpd-2.0/modules/dav/main/mod_dav.c
  
  Index: mod_dav.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/dav/main/mod_dav.c,v
  retrieving revision 1.107
  retrieving revision 1.108
  diff -u -u -r1.107 -r1.108
  --- mod_dav.c	21 May 2004 20:42:56 -0000	1.107
  +++ mod_dav.c	25 May 2004 17:13:07 -0000	1.108
  @@ -767,6 +767,7 @@
       char *range;
       char *dash;
       char *slash;
  +    char *errp;
   
       range_c = apr_table_get(r->headers_in, "content-range");
       if (range_c == NULL)
  @@ -780,15 +781,26 @@
           return 0;
       }
   
  -    *dash = *slash = '\0';
  +    *dash++ = *slash++ = '\0';
   
  -    *range_start = apr_atoi64(range + 6);
  -    *range_end = apr_atoi64(dash + 1);
  +    /* ignore invalid ranges. (per S14.16 of RFC2616) */
  +    if (apr_strtoff(range_start, range + 6, &errp, 10)
  +        || *errp || *range_start < 0) {
  +        return 0;
  +    }
   
  -    if (*range_end < *range_start
  -        || (slash[1] != '*' && apr_atoi64(slash + 1) <= *range_end)) {
  -        /* invalid range. ignore it (per S14.16 of RFC2616) */
  +    if (apr_strtoff(range_end, dash, &errp, 10)
  +        || *errp || *range_end < 0 || *range_end < *range_start) {
           return 0;
  +    }
  +
  +    if (*slash != '*') {
  +        apr_off_t dummy;
  +
  +        if (apr_strtoff(&dummy, slash, &errp, 10)
  +            || *errp || dummy <= *range_end) {
  +            return 0;
  +        }
       }
   
       /* we now have a valid range */
  
  
  

Mime
View raw message