Fix URL parsing with delimiting '/' and empty path - sacc - sacc(omys), simple console gopher client HTML git clone git://bitreich.org/sacc/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/sacc/ DIR Log DIR Files DIR Refs DIR Tags DIR LICENSE --- DIR commit 820448916f944175130c12b16a0cd6a6aae7b433 DIR parent fcd78143ca4ca607af282ce6abe8b903254a9b73 HTML Author: Quentin Rameau <quinq@fifth.space> Date: Mon, 19 Feb 2018 15:45:34 +0100 Fix URL parsing with delimiting '/' and empty path Diffstat: M sacc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- DIR diff --git a/sacc.c b/sacc.c @@ -772,15 +772,17 @@ moldentry(char *url) continue; case '/': *p = '\0'; - gopherpath = p+1; parsed = 1; continue; } } - if (*host == '\0' || *port == '\0' || ipv6 || *gopherpath == '\0') + if (*host == '\0' || *port == '\0' || ipv6) die("Can't parse url"); + if (*p != '\0') + gopherpath = p; + entry = xcalloc(sizeof(Item)); entry->type = gopherpath[0]; entry->username = entry->selector = ++gopherpath;