From 8113202c98888e092e1f4cdc2ee3ab34509d949c Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 30 Jun 2021 15:50:55 -0400 Subject: Avoid writing invalid prefixed name prefixes --- src/writer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/writer.c') 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); -- cgit v1.2.1