Fossil SCM
In login_redirect_to_g(), check only a fossil-goto value that begins with http: or https: in lower case against the base URL, and redirect to any other value relative to this host, as trunk does. This narrows [fb3970684d].
Commit
f0abcad3b95ecdff12106cdb275e13f35cc9a76b8fbdd29785fe8d1549e4688c
Parent
75f83fce6d6765d…
1 file changed
+4
-2
+4
-2
| --- src/login.c | ||
| +++ src/login.c | ||
| @@ -124,12 +124,14 @@ | ||
| 124 | 124 | if( zGoto ){ |
| 125 | 125 | cgi_redirectf("%R/%s",zGoto); |
| 126 | 126 | }else if( (zGoto = P("fossil-goto"))!=0 && zGoto[0]!=0 ){ |
| 127 | 127 | int n = g.zBaseURL ? (int)strlen(g.zBaseURL) : 0; |
| 128 | 128 | cgi_set_cookie("fossil-goto","",0,1); |
| 129 | - if( n>0 && strncmp(zGoto, g.zBaseURL, n)==0 | |
| 130 | - && (zGoto[n]==0 || zGoto[n]=='/') ){ | |
| 129 | + if( (fossil_strncmp(zGoto,"http:",5)!=0 | |
| 130 | + && fossil_strncmp(zGoto,"https:",6)!=0) | |
| 131 | + || (n>0 && strncmp(zGoto, g.zBaseURL, n)==0 | |
| 132 | + && (zGoto[n]==0 || zGoto[n]=='/')) ){ | |
| 131 | 133 | cgi_redirect(zGoto); |
| 132 | 134 | } |
| 133 | 135 | fossil_redirect_home(); |
| 134 | 136 | }else{ |
| 135 | 137 | fossil_redirect_home(); |
| 136 | 138 |
| --- src/login.c | |
| +++ src/login.c | |
| @@ -124,12 +124,14 @@ | |
| 124 | if( zGoto ){ |
| 125 | cgi_redirectf("%R/%s",zGoto); |
| 126 | }else if( (zGoto = P("fossil-goto"))!=0 && zGoto[0]!=0 ){ |
| 127 | int n = g.zBaseURL ? (int)strlen(g.zBaseURL) : 0; |
| 128 | cgi_set_cookie("fossil-goto","",0,1); |
| 129 | if( n>0 && strncmp(zGoto, g.zBaseURL, n)==0 |
| 130 | && (zGoto[n]==0 || zGoto[n]=='/') ){ |
| 131 | cgi_redirect(zGoto); |
| 132 | } |
| 133 | fossil_redirect_home(); |
| 134 | }else{ |
| 135 | fossil_redirect_home(); |
| 136 |
| --- src/login.c | |
| +++ src/login.c | |
| @@ -124,12 +124,14 @@ | |
| 124 | if( zGoto ){ |
| 125 | cgi_redirectf("%R/%s",zGoto); |
| 126 | }else if( (zGoto = P("fossil-goto"))!=0 && zGoto[0]!=0 ){ |
| 127 | int n = g.zBaseURL ? (int)strlen(g.zBaseURL) : 0; |
| 128 | cgi_set_cookie("fossil-goto","",0,1); |
| 129 | if( (fossil_strncmp(zGoto,"http:",5)!=0 |
| 130 | && fossil_strncmp(zGoto,"https:",6)!=0) |
| 131 | || (n>0 && strncmp(zGoto, g.zBaseURL, n)==0 |
| 132 | && (zGoto[n]==0 || zGoto[n]=='/')) ){ |
| 133 | cgi_redirect(zGoto); |
| 134 | } |
| 135 | fossil_redirect_home(); |
| 136 | }else{ |
| 137 | fossil_redirect_home(); |
| 138 |