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].

dmestas 2026-11-23 00:11 UTC small-fixes
Commit f0abcad3b95ecdff12106cdb275e13f35cc9a76b8fbdd29785fe8d1549e4688c
1 file changed +4 -2
+4 -2
--- src/login.c
+++ src/login.c
@@ -124,12 +124,14 @@
124124
if( zGoto ){
125125
cgi_redirectf("%R/%s",zGoto);
126126
}else if( (zGoto = P("fossil-goto"))!=0 && zGoto[0]!=0 ){
127127
int n = g.zBaseURL ? (int)strlen(g.zBaseURL) : 0;
128128
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]=='/')) ){
131133
cgi_redirect(zGoto);
132134
}
133135
fossil_redirect_home();
134136
}else{
135137
fossil_redirect_home();
136138
--- 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

Keyboard Shortcuts

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