diff options
author | Ali Fardan <raiz@stellarbound.space> | 2020-11-19 16:04:59 +0300 |
---|---|---|
committer | Ali Fardan <raiz@stellarbound.space> | 2020-11-19 16:04:59 +0300 |
commit | d83bdda139fbf732ff13b7e9de98f2b0a57ee1a0 (patch) | |
tree | 7fdc16071c4ddc9b11446b73d8b67dd09630a04b /yuri.c | |
parent | 1ae386c27797bcfb11d40a621f502cc120c884dd (diff) | |
download | libyuri-d83bdda139fbf732ff13b7e9de98f2b0a57ee1a0.tar.gz |
fix encode uninitialized strlcat() on string && introduce new uri_string_path() function
Diffstat (limited to 'yuri.c')
-rw-r--r-- | yuri.c | 23 |
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) { |