aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-03-17 13:04:36 +0100
committerDavid Robillard <d@drobilla.net>2019-12-19 20:55:28 -0500
commit0ce97313470a7c23bbad098346844f2ceabc07c5 (patch)
tree3b771ac0a8d40f97fa7b29fa961e6ecffe8d56e5 /src
parent2b8e55f6f1e25398f3d0189ff5917252d9c9be68 (diff)
downloadserd-0ce97313470a7c23bbad098346844f2ceabc07c5.tar.gz
serd-0ce97313470a7c23bbad098346844f2ceabc07c5.tar.bz2
serd-0ce97313470a7c23bbad098346844f2ceabc07c5.zip
Avoid writing invalid prefixed name prefixes
Diffstat (limited to 'src')
-rw-r--r--src/writer.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/writer.c b/src/writer.c
index 4b3387c3..f6c16d67 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -475,7 +475,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)
{
@@ -512,6 +512,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);