diff options
Diffstat (limited to 'xs_url.h')
| -rw-r--r-- | xs_url.h | 8 |
1 files changed, 7 insertions, 1 deletions
| @@ -17,12 +17,18 @@ xs_str *xs_url_dec(const char *str) | |||
| 17 | xs_str *s = xs_str_new(NULL); | 17 | xs_str *s = xs_str_new(NULL); |
| 18 | 18 | ||
| 19 | while (*str) { | 19 | while (*str) { |
| 20 | if (!xs_is_string(str)) | ||
| 21 | break; | ||
| 22 | |||
| 20 | if (*str == '%') { | 23 | if (*str == '%') { |
| 21 | unsigned int i; | 24 | unsigned int i; |
| 22 | 25 | ||
| 23 | if (sscanf(str + 1, "%02x", &i) == 1) { | 26 | if (sscanf(str + 1, "%02x", &i) == 1) { |
| 24 | unsigned char uc = i; | 27 | unsigned char uc = i; |
| 25 | 28 | ||
| 29 | if (!xs_is_string((char *)&uc)) | ||
| 30 | break; | ||
| 31 | |||
| 26 | s = xs_append_m(s, (char *)&uc, 1); | 32 | s = xs_append_m(s, (char *)&uc, 1); |
| 27 | str += 2; | 33 | str += 2; |
| 28 | } | 34 | } |
| @@ -69,7 +75,7 @@ xs_dict *xs_url_vars(const char *str) | |||
| 69 | 75 | ||
| 70 | vars = xs_dict_new(); | 76 | vars = xs_dict_new(); |
| 71 | 77 | ||
| 72 | if (str != NULL) { | 78 | if (xs_is_string(str)) { |
| 73 | /* split by arguments */ | 79 | /* split by arguments */ |
| 74 | xs *args = xs_split(str, "&"); | 80 | xs *args = xs_split(str, "&"); |
| 75 | 81 | ||