diff options
author | David Robillard <d@drobilla.net> | 2019-03-17 13:04:36 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-10-27 13:13:58 +0100 |
commit | 8bc4e0d94cdcd7b05ec50533cb8b618e47eb13aa (patch) | |
tree | ebae727b36c8cee5fc504a1437220981d7d080cf | |
parent | 14f1d39b4180475a5fa9030fccf95fdc8b693c09 (diff) | |
download | serd-8bc4e0d94cdcd7b05ec50533cb8b618e47eb13aa.tar.gz serd-8bc4e0d94cdcd7b05ec50533cb8b618e47eb13aa.tar.bz2 serd-8bc4e0d94cdcd7b05ec50533cb8b618e47eb13aa.zip |
Avoid writing invalid prefixed name prefixes
-rw-r--r-- | src/writer.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/writer.c b/src/writer.c index 1868b106..fc8f86b4 100644 --- a/src/writer.c +++ b/src/writer.c @@ -477,7 +477,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) { @@ -514,6 +514,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_string(prefix), serd_node_length(prefix)) && is_name(suffix.buf, suffix.len)) { write_uri_from_node(writer, prefix); sink(":", 1, writer); |