Fossil SCM

Ignore an HTTP Range header whose last byte is the largest int, which overflowed the arithmetic for the end of the range.

dmestas 2026-11-20 20:41 UTC small-fixes
Commit 137ebe6e987886fc6fa6edaa25e203f0df8f27c6d7f3bdd7c523e3e74e5c0258
1 file changed +2 -1
+2 -1
--- src/cgi.c
+++ src/cgi.c
@@ -2269,11 +2269,12 @@
22692269
cgi_replace_parameter("REMOTE_ADDR", g.zIpAddr);
22702270
}
22712271
}else if( fossil_strcmp(zFieldName,"range:")==0 ){
22722272
int x1 = 0;
22732273
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 ){
22752276
rangeStart = x1;
22762277
rangeEnd = x2+1;
22772278
}
22782279
}
22792280
}
22802281
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button