summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/ModHelpers
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-10-12 22:20:19 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-10-12 22:20:19 -0400
commit1e19a170be1d540e815f89c1ae60c2b53f6123bf (patch)
tree8a2a0bac8b71b104daf0dc7ae913311b0724f73f /src/SMAPI/Framework/ModHelpers
parent61a8b7bf2dcf9b8167fe0119a574d34ef97f1351 (diff)
downloadSMAPI-1e19a170be1d540e815f89c1ae60c2b53f6123bf.tar.gz
SMAPI-1e19a170be1d540e815f89c1ae60c2b53f6123bf.tar.bz2
SMAPI-1e19a170be1d540e815f89c1ae60c2b53f6123bf.zip
refuse to load custom map tilesheets with absolute or directory-climbing paths (#368)
Diffstat (limited to 'src/SMAPI/Framework/ModHelpers')
-rw-r--r--src/SMAPI/Framework/ModHelpers/ContentHelper.cs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/SMAPI/Framework/ModHelpers/ContentHelper.cs b/src/SMAPI/Framework/ModHelpers/ContentHelper.cs
index 4440ae40..4f5bd2f0 100644
--- a/src/SMAPI/Framework/ModHelpers/ContentHelper.cs
+++ b/src/SMAPI/Framework/ModHelpers/ContentHelper.cs
@@ -239,6 +239,10 @@ namespace StardewModdingAPI.Framework.ModHelpers
{
string imageSource = tilesheet.ImageSource;
+ // validate
+ if (Path.IsPathRooted(imageSource) || imageSource.Split(SContentManager.PossiblePathSeparators).Contains(".."))
+ throw new ContentLoadException($"The '{imageSource}' tilesheet couldn't be loaded. Tilesheet paths must be a relative path without directory climbing (../).");
+
// get seasonal name (if applicable)
string seasonalImageSource = null;
if (Game1.currentSeason != null)