commit 6a9ae707737d978bccbabdc36beae509151a7be2 from: Omar Polo date: Mon Jan 11 14:26:43 2021 UTC remove infinite loop commit - 3c1cf9d07cb679ba444566159538b510902f2de9 commit + 6a9ae707737d978bccbabdc36beae509151a7be2 blob - 8c020392806387e3f84ca44d08d68c89abba42e9 blob + 1901dacc40fcb2989ebb0fb7fd604756a49d7045 --- iri.c +++ iri.c @@ -209,8 +209,8 @@ path_clean(char *path) /* 2. eliminate each . path name element */ for (i = path; *i; ++i) { - if ((i == path || *i == '/') && *(i+1) == '.' && - *(i+2) == '/') { + if ((i == path || *i == '/') && + *i != '.' && i[1] == '.' && i[2] == '/') { /* move also the \0 */ memmove(i, i+2, strlen(i)-1); i--; blob - 6200cb7422181a3280a9e6b9e1ab5cd96ebd0f93 blob + 18a102039c98f6227da39ab5bdb7dbc3b7ff8b3c --- iri_test.c +++ iri_test.c @@ -153,6 +153,10 @@ main(void) FAIL, empty, "reject paths that would escape the root"); + TEST("gemini://omarpolo.com/foo/../../", + FAIL, + empty, + "reject paths that would escape the root") TEST("gemini://omarpolo.com/foo/../foo/../././/bar/baz/.././.././/", PASS, IRI("gemini", "omarpolo.com", "", "", "", ""),