aboutsummaryrefslogtreecommitdiffstats
path: root/src/uri.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-10-20 11:30:48 +0200
committerDavid Robillard <d@drobilla.net>2018-10-28 14:21:14 +0100
commitdfacddf8e61869ff9a9bce2b5c6911edb2312d3f (patch)
tree5cd2fa5521d21321a77ddb0ff3aed13297c3914a /src/uri.c
parentdfe929e21a47f1f5bb6fec3f57180fe8b860ecd2 (diff)
downloadserd-dfacddf8e61869ff9a9bce2b5c6911edb2312d3f.tar.gz
serd-dfacddf8e61869ff9a9bce2b5c6911edb2312d3f.tar.bz2
serd-dfacddf8e61869ff9a9bce2b5c6911edb2312d3f.zip
Avoid use of sscanf for parsing escapes in URIs
Diffstat (limited to 'src/uri.c')
-rw-r--r--src/uri.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/uri.c b/src/uri.c
index 249b2674..70b13717 100644
--- a/src/uri.c
+++ b/src/uri.c
@@ -77,10 +77,8 @@ serd_file_uri_parse(const uint8_t* uri, uint8_t** hostname)
serd_chunk_sink("%", 1, &chunk);
++s;
} else if (is_hexdig(*(s + 1)) && is_hexdig(*(s + 2))) {
- const uint8_t code[3] = { *(s + 1), *(s + 2), 0 };
- uint32_t num;
- sscanf((const char*)code, "%X", &num);
- const uint8_t c = num;
+ const uint8_t code[3] = {*(s + 1), *(s + 2), 0};
+ const uint8_t c = (uint8_t)strtoul((const char*)code, NULL, 16);
serd_chunk_sink(&c, 1, &chunk);
s += 2;
} else {