aboutsummaryrefslogtreecommitdiffstats
path: root/src/writer.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-06-30 15:50:55 -0400
committerDavid Robillard <d@drobilla.net>2021-06-30 15:50:55 -0400
commit8113202c98888e092e1f4cdc2ee3ab34509d949c (patch)
tree475697cd2eb530a1e8248d7ebedbfdd8f3c5a6b2 /src/writer.c
parent6756ac82c504c6b1a395f5c0fee6ffd4fd3bca21 (diff)
downloadserd-8113202c98888e092e1f4cdc2ee3ab34509d949c.tar.gz
serd-8113202c98888e092e1f4cdc2ee3ab34509d949c.tar.bz2
serd-8113202c98888e092e1f4cdc2ee3ab34509d949c.zip
Avoid writing invalid prefixed name prefixes
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 aaf2f175..a5a17163 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -551,7 +551,7 @@ write_literal(SerdWriter* writer,
return true;
}
-// Return true iff `buf` is a valid prefixed name suffix
+// Return true iff `buf` is a valid prefixed name prefix or suffix
static bool
is_name(const uint8_t* buf, const size_t len)
{
@@ -593,6 +593,7 @@ write_uri_node(SerdWriter* const writer,
if (has_scheme && (writer->style & SERD_STYLE_CURIED) &&
serd_env_qualify(writer->env, node, &prefix, &suffix) &&
+ is_name(prefix.buf, prefix.n_bytes) &&
is_name(suffix.buf, suffix.len)) {
write_uri(writer, prefix.buf, prefix.n_bytes);
sink(":", 1, writer);