From f3db3d6a001abdca53d88def7a22a40d6aa30271 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Thu, 7 May 2009 06:31:16 +0000 Subject: * Added some more GetAssetStreamHandlerTests * In the process, caught a potential bug where the handler would allow paths not starting with the registered prefix --- OpenSim/Framework/Servers/HttpServer/BaseRequestHandler.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework/Servers/HttpServer/BaseRequestHandler.cs') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseRequestHandler.cs b/OpenSim/Framework/Servers/HttpServer/BaseRequestHandler.cs index 5ad4520..da4f9a8 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseRequestHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseRequestHandler.cs @@ -58,14 +58,22 @@ namespace OpenSim.Framework.Servers.HttpServer public string GetParam(string path) { - try + if (CheckParam(path)) { return path.Substring(m_path.Length); } - catch (Exception) + + return String.Empty; + } + + protected bool CheckParam(string path) + { + if(String.IsNullOrEmpty(path)) { - return String.Empty; + return false; } + + return path.StartsWith(Path); } } } -- cgit v1.1