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>2021-03-08 23:23:05 -0500
commite0fc63762de7fd92d6b35c20185e14117839a90f (patch)
treec73350a02301a9ef168677099ba6a09ca836e958 /src/writer.c
parentb983d2a94b0f84b4c06889be77fbdacc502f2d7b (diff)
downloadserd-e0fc63762de7fd92d6b35c20185e14117839a90f.tar.gz
serd-e0fc63762de7fd92d6b35c20185e14117839a90f.tar.bz2
serd-e0fc63762de7fd92d6b35c20185e14117839a90f.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 9b10848f..663d8f64 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -541,7 +541,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)
{
@@ -583,6 +583,7 @@ write_uri_node(SerdWriter* const writer,
if (has_scheme && (writer->flags & SERD_WRITE_CURIED) &&
serd_env_qualify_in_place(writer->env, node, &prefix, &suffix) &&
+ is_name(serd_node_string(prefix), serd_node_length(prefix)) &&
is_name(suffix.buf, suffix.len)) {
write_uri_from_node(writer, prefix);
sink(":", 1, writer);