diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-09 11:07:29 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-09 11:07:29 +0000 |
commit | ed184bd1510c4cff6a53a7a5bfafaac48eece9e0 (patch) | |
tree | 7087917684d9ae7f89e664534dd18c796bdd9472 /src/inspircd_util.cpp | |
parent | eb0f039d0f66dc2fc920ed49cf0539ca186f6fe2 (diff) |
Added security function that removes paths from filenames
Stripped paths from filenames in /rehash and /modules
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@464 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/inspircd_util.cpp')
-rw-r--r-- | src/inspircd_util.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/inspircd_util.cpp b/src/inspircd_util.cpp index 0a3d966d3..29011eb9a 100644 --- a/src/inspircd_util.cpp +++ b/src/inspircd_util.cpp @@ -66,5 +66,18 @@ char *CleanIpAddr (char *cleanAddr, const char *dirtyAddr) return (cleanAddr); } - +char* CleanFilename(char* name) +{ + char* p = name + strlen(name); + while ((p != name) && (*p != '/')) + p--; + if ( p != name) + { + return ++p; + } + else + { + return p; + } +} |