aboutsummaryrefslogtreecommitdiffstats
path: root/src/writer.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-03-15 18:02:32 -0400
committerDavid Robillard <d@drobilla.net>2016-03-15 18:02:32 -0400
commitbb8f19e9e4fbcfa015f48377df34cb89e5b1173e (patch)
tree29fe8e76af6dec007b3efbfd8c377fc54f141aab /src/writer.c
parent530a14b795329e1bd3ecf98a0b0d924bcfdc6736 (diff)
downloadserd-bb8f19e9e4fbcfa015f48377df34cb89e5b1173e.tar.gz
serd-bb8f19e9e4fbcfa015f48377df34cb89e5b1173e.tar.bz2
serd-bb8f19e9e4fbcfa015f48377df34cb89e5b1173e.zip
Fix potential out of bounds read
Diffstat (limited to 'src/writer.c')
-rw-r--r--src/writer.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/writer.c b/src/writer.c
index 59080592..a037bf81 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -522,7 +522,8 @@ write_node(SerdWriter* writer,
!strcmp(type_uri + sizeof(NS_XSD) - 1, "integer"))) {
sink(node->buf, node->n_bytes, writer);
break;
- } else if (!strcmp(type_uri + sizeof(NS_XSD) - 1, "decimal") &&
+ } else if (!strncmp(type_uri, NS_XSD, sizeof(NS_XSD) - 1) &&
+ !strcmp(type_uri + sizeof(NS_XSD) - 1, "decimal") &&
strchr((const char*)node->buf, '.') &&
node->buf[node->n_bytes - 1] != '.') {
/* xsd:decimal literals without trailing digits, e.g. "5.", can