From: André Malo Date: Tue, 25 May 2004 19:09:45 +0000 (+0000) Subject: parse byteranges correctly using the new apr_strtoff function X-Git-Tag: pre_ajp_proxy~224 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9266375e50fed6828c2b4ec27e77c3a84e1c3d13;p=apache parse byteranges correctly using the new apr_strtoff function git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@103765 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index a8ffa87173..7020018bd6 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -2788,6 +2788,8 @@ static int parse_byterange(char *range, apr_off_t clength, apr_off_t *start, apr_off_t *end) { char *dash = strchr(range, '-'); + char *errp; + apr_off_t number; if (!dash) { return 0; @@ -2795,15 +2797,23 @@ static int parse_byterange(char *range, apr_off_t clength, if ((dash == range)) { /* In the form "-5" */ - *start = clength - apr_atoi64(dash + 1); + if (apr_strtoff(&number, dash+1, &errp, 10) || *errp) { + return 0; + } + *start = clength - number; *end = clength - 1; } else { - *dash = '\0'; - dash++; - *start = apr_atoi64(range); + *dash++ = '\0'; + if (apr_strtoff(&number, range, &errp, 10) || *errp) { + return 0; + } + *start = number; if (*dash) { - *end = apr_atoi64(dash); + if (apr_strtoff(&number, dash, &errp, 10) || *errp) { + return 0; + } + *end = number; } else { /* "5-" */ *end = clength - 1;