diff options
author | William A. Rowe Jr <wrowe@apache.org> | 2006-03-01 15:03:54 +0000 |
---|---|---|
committer | William A. Rowe Jr <wrowe@apache.org> | 2006-03-01 15:03:54 +0000 |
commit | a62bd58816f80cd4ca620f6782088bac0a8d350d (patch) | |
tree | 61c78ba2f1f7594b3405e95247576a0d84e1267b | |
parent | f40c2705b0eb4d0707aec5d847a63edb03bad80d (diff) | |
download | apr-a62bd58816f80cd4ca620f6782088bac0a8d350d.tar.gz |
Close bug 38801; add optimization but test the slash delimit for
both test cases. Passes the testnames suite.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@382043 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | file_io/win32/filepath.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/file_io/win32/filepath.c b/file_io/win32/filepath.c index ea80e14b9..8b7b32445 100644 --- a/file_io/win32/filepath.c +++ b/file_io/win32/filepath.c @@ -801,16 +801,17 @@ APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath, * segment is thoroughly tested prior to path parsing. */ if ((flags & APR_FILEPATH_NOTABOVEROOT) && (baselen || rootlen)) { - if (baselen && memcmp(basepath, path + rootlen, baselen) && - basepath[baselen - 1] != '/' && basepath[baselen - 1] != '\\') - return APR_EABOVEROOT; + if (basepath[baselen - 1] != '/' && basepath[baselen - 1] != '\\') { + if (baselen && memcmp(basepath, path + rootlen, baselen)) + return APR_EABOVEROOT; - /* Ahem... if we weren't given a trailing slash on the basepath, - * we better be sure that /foo wasn't replaced with /foobar! - */ - if (path[rootlen + baselen] && path[rootlen + baselen] != '/' - && path[rootlen + baselen] != '\\') - return APR_EABOVEROOT; + /* Ahem... if we weren't given a trailing slash on the basepath, + * we better be sure that /foo wasn't replaced with /foobar! + */ + if (path[rootlen + baselen] && path[rootlen + baselen] != '/' + && path[rootlen + baselen] != '\\') + return APR_EABOVEROOT; + } } if (addpath && (flags & APR_FILEPATH_TRUENAME)) { |