summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2015-08-10 22:02:19 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2015-08-10 22:02:19 +0200
commit5c724b8b1aba860eb8a48dc230fa417014a11ba7 (patch)
treeaba5589a51a8dc5fe79f28c7fcd2b655615fe948
parent2cfd2e4c96ff281244e678d9f3cc4b2836ae796a (diff)
util: parseuri: nul-terminate, bug introduced by 7f11ef506465896705f15c39bd0416d96ca651a8
-rw-r--r--util.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/util.c b/util.c
index 9b3da1b..a2d7f28 100644
--- a/util.c
+++ b/util.c
@@ -44,6 +44,7 @@ parseuri(const char *s, struct uri *u, int rel)
if (p - s + 1 >= (ssize_t)sizeof(u->proto))
return -1; /* protocol too long */
memcpy(u->proto, s, p - s);
+ u->proto[p - s] = '\0';
p += 3; /* skip "://" */
} else {
p = s; /* no protocol format, set to start */
@@ -57,6 +58,7 @@ parseuri(const char *s, struct uri *u, int rel)
if (i + 1 >= sizeof(u->host))
return -1; /* host too long */
memcpy(u->host, p, i);
+ u->host[i] = '\0';
p = &p[i];
readpath: