summary refs log tree commit diff stats
path: root/yuri.c
diff options
context:
space:
mode:
authorAli Fardan <raiz@stellarbound.space>2020-11-19 16:04:59 +0300
committerAli Fardan <raiz@stellarbound.space>2020-11-19 16:04:59 +0300
commitd83bdda139fbf732ff13b7e9de98f2b0a57ee1a0 (patch)
tree7fdc16071c4ddc9b11446b73d8b67dd09630a04b /yuri.c
parent1ae386c27797bcfb11d40a621f502cc120c884dd (diff)
downloadlibyuri-d83bdda139fbf732ff13b7e9de98f2b0a57ee1a0.tar.gz
fix encode uninitialized strlcat() on string && introduce new uri_string_path() function
Diffstat (limited to 'yuri.c')
-rw-r--r--yuri.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/yuri.c b/yuri.c
index 3ffcc53..89c2a2f 100644
--- a/yuri.c
+++ b/yuri.c
@@ -257,6 +257,29 @@ uri_get_path(struct uri *u)
 	return u->path;
 }
 
+/*
+ * TODO: cleanup
+ */
+char *
+uri_string_path(struct uri *u)
+{
+	struct uri *temp;
+	char *ret;
+
+	temp = uri_new();
+	if (temp == NULL)
+		return NULL;
+	temp->path = u->path;
+	temp->npath = u->npath;
+
+	ret = uri_encode(temp);
+	free(temp);
+	if (ret == NULL)
+		return NULL;
+
+	return ret;
+}
+
 int
 uri_get_npath(struct uri *u)
 {