Fossil SCM

Fix bug mentioned in [forum:a4c682e21ce329fe] to make URL parser require properly formed URL containing a slash following the port.

andybradford 2021-09-29 03:22 trunk
Commit fb752a04f5cb974b0ad4b3e6b358abc68b02efef7ee090dea5f49b0a48eef2d2
1 file changed +1
+1
--- src/url.c
+++ src/url.c
@@ -196,10 +196,11 @@
196196
i++;
197197
while( (c = zUrl[i])!=0 && fossil_isdigit(c) ){
198198
pUrlData->port = pUrlData->port*10 + c - '0';
199199
i++;
200200
}
201
+ if( c!=0 && c!='/' ) fossil_fatal("url missing '/' after port number");
201202
pUrlData->hostname = mprintf("%s:%d", pUrlData->name, pUrlData->port);
202203
}else{
203204
pUrlData->port = pUrlData->dfltPort;
204205
pUrlData->hostname = pUrlData->name;
205206
}
206207
--- src/url.c
+++ src/url.c
@@ -196,10 +196,11 @@
196 i++;
197 while( (c = zUrl[i])!=0 && fossil_isdigit(c) ){
198 pUrlData->port = pUrlData->port*10 + c - '0';
199 i++;
200 }
 
201 pUrlData->hostname = mprintf("%s:%d", pUrlData->name, pUrlData->port);
202 }else{
203 pUrlData->port = pUrlData->dfltPort;
204 pUrlData->hostname = pUrlData->name;
205 }
206
--- src/url.c
+++ src/url.c
@@ -196,10 +196,11 @@
196 i++;
197 while( (c = zUrl[i])!=0 && fossil_isdigit(c) ){
198 pUrlData->port = pUrlData->port*10 + c - '0';
199 i++;
200 }
201 if( c!=0 && c!='/' ) fossil_fatal("url missing '/' after port number");
202 pUrlData->hostname = mprintf("%s:%d", pUrlData->name, pUrlData->port);
203 }else{
204 pUrlData->port = pUrlData->dfltPort;
205 pUrlData->hostname = pUrlData->name;
206 }
207

Keyboard Shortcuts

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