From a0d356d595f3c4a016828df830161fbb17e967a9 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 17 Mar 2019 13:04:36 +0100 Subject: Avoid writing invalid prefixed name prefixes --- src/writer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/writer.c b/src/writer.c index 4b6b5579..fad22ee2 100644 --- a/src/writer.c +++ b/src/writer.c @@ -478,7 +478,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) { @@ -515,6 +515,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); -- cgit v1.2.1