aboutsummaryrefslogtreecommitdiffstats
path: root/src/writer.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-03-17 13:04:36 +0100
committerDavid Robillard <d@drobilla.net>2019-04-13 19:15:32 +0200
commit81f46794f4f1cc2f2da3eab3fa98c399d01715ef (patch)
tree42351df288d6ed38a33c1002bb5b708b0c035a15 /src/writer.c
parent52179a7573a80b088e4fe1bd7d62e3e4cbbe2327 (diff)
downloadserd-81f46794f4f1cc2f2da3eab3fa98c399d01715ef.tar.gz
serd-81f46794f4f1cc2f2da3eab3fa98c399d01715ef.tar.bz2
serd-81f46794f4f1cc2f2da3eab3fa98c399d01715ef.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 673d467e..a5a2b663 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -479,7 +479,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 inline bool
is_name(const char* buf, const size_t len)
{
@@ -516,6 +516,7 @@ write_uri_node(SerdWriter* const writer,
return sink("()", 2, writer) == 2;
} else if (has_scheme && (writer->style & SERD_STYLE_CURIED) &&
serd_env_qualify_in_place(writer->env, node, &prefix, &suffix) &&
+ is_name(serd_node_get_string(prefix), serd_node_get_length(prefix)) &&
is_name(suffix.buf, suffix.len)) {
write_uri_from_node(writer, prefix);
sink(":", 1, writer);