Fossil SCM
Ignore an HTTP Range header whose last byte is the largest int, which overflowed the arithmetic for the end of the range.
Commit
137ebe6e987886fc6fa6edaa25e203f0df8f27c6d7f3bdd7c523e3e74e5c0258
Parent
22ed60a53b0acaa…
1 file changed
+2
-1
+2
-1
| --- src/cgi.c | ||
| +++ src/cgi.c | ||
| @@ -2269,11 +2269,12 @@ | ||
| 2269 | 2269 | cgi_replace_parameter("REMOTE_ADDR", g.zIpAddr); |
| 2270 | 2270 | } |
| 2271 | 2271 | }else if( fossil_strcmp(zFieldName,"range:")==0 ){ |
| 2272 | 2272 | int x1 = 0; |
| 2273 | 2273 | int x2 = 0; |
| 2274 | - if( sscanf(zVal,"bytes=%d-%d",&x1,&x2)==2 && x1>=0 && x1<=x2 ){ | |
| 2274 | + if( sscanf(zVal,"bytes=%d-%d",&x1,&x2)==2 && x1>=0 && x1<=x2 | |
| 2275 | + && x2<0x7fffffff ){ | |
| 2275 | 2276 | rangeStart = x1; |
| 2276 | 2277 | rangeEnd = x2+1; |
| 2277 | 2278 | } |
| 2278 | 2279 | } |
| 2279 | 2280 | } |
| 2280 | 2281 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -2269,11 +2269,12 @@ | |
| 2269 | cgi_replace_parameter("REMOTE_ADDR", g.zIpAddr); |
| 2270 | } |
| 2271 | }else if( fossil_strcmp(zFieldName,"range:")==0 ){ |
| 2272 | int x1 = 0; |
| 2273 | int x2 = 0; |
| 2274 | if( sscanf(zVal,"bytes=%d-%d",&x1,&x2)==2 && x1>=0 && x1<=x2 ){ |
| 2275 | rangeStart = x1; |
| 2276 | rangeEnd = x2+1; |
| 2277 | } |
| 2278 | } |
| 2279 | } |
| 2280 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -2269,11 +2269,12 @@ | |
| 2269 | cgi_replace_parameter("REMOTE_ADDR", g.zIpAddr); |
| 2270 | } |
| 2271 | }else if( fossil_strcmp(zFieldName,"range:")==0 ){ |
| 2272 | int x1 = 0; |
| 2273 | int x2 = 0; |
| 2274 | if( sscanf(zVal,"bytes=%d-%d",&x1,&x2)==2 && x1>=0 && x1<=x2 |
| 2275 | && x2<0x7fffffff ){ |
| 2276 | rangeStart = x1; |
| 2277 | rangeEnd = x2+1; |
| 2278 | } |
| 2279 | } |
| 2280 | } |
| 2281 |