Skip to content

Commit 8e9835f

Browse files
committed
Sanitize login return url and theme path
1 parent ae39067 commit 8e9835f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

BlogEngine/BlogEngine.Core/BlogSettings.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -420,27 +420,27 @@ public string Theme
420420
var request = context.Request;
421421
if (request.QueryString["theme"] != null)
422422
{
423-
return request.QueryString["theme"];
423+
return request.QueryString["theme"].SanitizePath();
424424
}
425425

426426
var cookie = request.Cookies[this.ThemeCookieName];
427427
if (cookie != null)
428428
{
429-
return cookie.Value;
429+
return cookie.Value.SanitizePath();
430430
}
431431

432432
if (Utils.ShouldForceMainTheme(request))
433433
{
434-
return this.configuredTheme;
434+
return this.configuredTheme.SanitizePath();
435435
}
436436
}
437437

438-
return this.configuredTheme;
438+
return this.configuredTheme.SanitizePath();
439439
}
440440

441441
set
442442
{
443-
this.configuredTheme = String.IsNullOrEmpty(value) ? String.Empty : value;
443+
this.configuredTheme = String.IsNullOrEmpty(value) ? String.Empty : value.SanitizePath();
444444
}
445445
}
446446

BlogEngine/BlogEngine.NET/Custom/Controls/PostList.ascx.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ private void BindPosts()
123123

124124
var theme = Request.QueryString["theme"];
125125
if(!string.IsNullOrEmpty(theme))
126-
theme = theme.Replace(".", "").Replace("/", "").Replace("\\", "");
126+
theme = theme.SanitizePath();
127127

128128
var path = string.Format("{0}Custom/Themes/{1}/PostView.ascx", Utils.ApplicationRelativeWebRoot, BlogSettings.Instance.GetThemeWithAdjustments(theme));
129129
var counter = 0;

0 commit comments

Comments
 (0)