url: Use ascii module, rather than ctype for locale safetly.

This commit is contained in:
Michael Drake 2016-08-12 09:18:27 +01:00
parent efeeacca86
commit a1668f6c1e

View File

@ -35,7 +35,9 @@
#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include "utils/ascii.h"
#include "utils/config.h"
#include "utils/log.h"
#include "utils/url.h"
@ -92,7 +94,7 @@ nserror url_unescape(const char *str, size_t length,
char c1 = *(str + 1);
char c2 = *(str + 2);
if (c == '%' && isxdigit(c1) && isxdigit(c2)) {
if (c == '%' && ascii_is_hex(c1) && ascii_is_hex(c2)) {
c = xdigit_to_hex(c1) << 4 | xdigit_to_hex(c2);
str += 2;
}