aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-09-16 22:45:48 +0200
committerDavid Robillard <d@drobilla.net>2018-09-16 22:49:42 +0200
commite7f9b51da8597dc70a432b4272429188e4ce69e1 (patch)
tree33ff448fd044b06040b18af4f689bd22d6447632 /src
parentb1824007fb21d9074006023174c34ea911dc7840 (diff)
downloadserd-e7f9b51da8597dc70a432b4272429188e4ce69e1.tar.gz
serd-e7f9b51da8597dc70a432b4272429188e4ce69e1.tar.bz2
serd-e7f9b51da8597dc70a432b4272429188e4ce69e1.zip
Use strtoul instead of sscanf for converting hex
Diffstat (limited to 'src')
-rw-r--r--src/n3.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/n3.c b/src/n3.c
index 0a3e1fd3..edf773c7 100644
--- a/src/n3.c
+++ b/src/n3.c
@@ -77,8 +77,9 @@ read_UCHAR(SerdReader* reader, Ref dest, uint32_t* char_code)
}
}
- uint32_t code;
- sscanf((const char*)buf, "%X", &code);
+ char* endptr = NULL;
+ const uint32_t code = strtoul((const char*)buf, &endptr, 16);
+ assert(endptr == (char*)buf + length);
unsigned size = 0;
if (code < 0x00000080) {