diff options
Diffstat (limited to 'scan_urlencoded_query.c')
| -rw-r--r-- | scan_urlencoded_query.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/scan_urlencoded_query.c b/scan_urlencoded_query.c index cf0c5b1..4825a4a 100644 --- a/scan_urlencoded_query.c +++ b/scan_urlencoded_query.c | |||
| @@ -170,16 +170,12 @@ size_t fmt_urlencoded(char *dest, const uint8_t *src, size_t len) { | |||
| 170 | 170 | ||
| 171 | /* strchr would find the terminator, so a zero byte never counts as safe */ | 171 | /* strchr would find the terminator, so a zero byte never counts as safe */ |
| 172 | if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || (c && strchr(safe, c))) { | 172 | if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || (c && strchr(safe, c))) { |
| 173 | if (dest) | 173 | dest[written++] = (char)c; |
| 174 | dest[written] = (char)c; | ||
| 175 | ++written; | ||
| 176 | } else { | 174 | } else { |
| 177 | if (dest) { | 175 | dest[written] = '%'; |
| 178 | dest[written] = '%'; | 176 | dest[written + 1] = hexdigit[c >> 4]; |
| 179 | dest[written + 1] = hexdigit[c >> 4]; | 177 | dest[written + 2] = hexdigit[c & 15]; |
| 180 | dest[written + 2] = hexdigit[c & 15]; | 178 | written += 3; |
| 181 | } | ||
| 182 | written += 3; | ||
| 183 | } | 179 | } |
| 184 | } | 180 | } |
| 185 | 181 | ||
