mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-25 12:04:47 +00:00
Merge pull request #2718 from cesanta/pathissane
change mg_path_is_sane()
This commit is contained in:
9 files changed
+45
-33
No files matched your search
+16
-14
@@ -2107,20 +2107,22 @@ static void test_str(void) {
|
||||
ASSERT(strcmp(buf, "[164:2100:0:0:0:0:0:0]:3 7") == 0);
|
||||
}
|
||||
|
||||
ASSERT(mg_path_is_sane(".") == true);
|
||||
ASSERT(mg_path_is_sane("") == true);
|
||||
ASSERT(mg_path_is_sane("a.b") == true);
|
||||
ASSERT(mg_path_is_sane("a..b") == true);
|
||||
ASSERT(mg_path_is_sane(".a") == true);
|
||||
ASSERT(mg_path_is_sane(".a.") == true);
|
||||
ASSERT(mg_path_is_sane("./") == true);
|
||||
ASSERT(mg_path_is_sane("a..") == true);
|
||||
ASSERT(mg_path_is_sane("././a..") == true);
|
||||
ASSERT(mg_path_is_sane("..") == false);
|
||||
ASSERT(mg_path_is_sane("../") == false);
|
||||
ASSERT(mg_path_is_sane("./..") == false);
|
||||
ASSERT(mg_path_is_sane("a/../") == false);
|
||||
ASSERT(mg_path_is_sane("a/../b") == false);
|
||||
ASSERT(mg_path_is_sane(mg_str(".")) == true);
|
||||
ASSERT(mg_path_is_sane(mg_str("")) == true);
|
||||
ASSERT(mg_path_is_sane(mg_str("a.b")) == true);
|
||||
ASSERT(mg_path_is_sane(mg_str("a..b")) == true);
|
||||
ASSERT(mg_path_is_sane(mg_str(".a")) == true);
|
||||
ASSERT(mg_path_is_sane(mg_str(".a.")) == true);
|
||||
ASSERT(mg_path_is_sane(mg_str("./")) == true);
|
||||
ASSERT(mg_path_is_sane(mg_str("a..")) == true);
|
||||
ASSERT(mg_path_is_sane(mg_str("././a..")) == true);
|
||||
ASSERT(mg_path_is_sane(mg_str("..")) == false);
|
||||
ASSERT(mg_path_is_sane(mg_str("../")) == false);
|
||||
ASSERT(mg_path_is_sane(mg_str("./..")) == false);
|
||||
ASSERT(mg_path_is_sane(mg_str("a/../")) == false);
|
||||
ASSERT(mg_path_is_sane(mg_str("a/../b")) == false);
|
||||
ASSERT(mg_path_is_sane(mg_str_n("a/..", 2)) == true);
|
||||
ASSERT(mg_path_is_sane(mg_str_n("a/../b", 2)) == true);
|
||||
}
|
||||
|
||||
static void fn1(struct mg_connection *c, int ev, void *ev_data) {
|
||||
|
||||
Reference in new issue
Block a user