From 0046d61833ae1f6a7d5d4bff836d20ddbf571df9 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 8 Mar 2012 15:59:08 +0000 Subject: Refuse to intern relative URIs in sord_new_uri*(). Make sord_iter_get_node() tolerate a NULL iterator. git-svn-id: http://svn.drobilla.net/sord/trunk@202 3d64ff67-21c5-427c-a301-fe4f08042e5a --- src/sord.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/sord.c b/src/sord.c index eac5087..2ffa414 100644 --- a/src/sord.c +++ b/src/sord.c @@ -424,7 +424,7 @@ sord_iter_get(const SordIter* iter, SordQuad id) const SordNode* sord_iter_get_node(const SordIter* iter, SordQuadIndex index) { - return ((SordNode**)zix_tree_get(iter->cur))[index]; + return iter ? ((SordNode**)zix_tree_get(iter->cur))[index] : NULL; } bool @@ -958,6 +958,10 @@ static SordNode* sord_new_uri_counted(SordWorld* world, const uint8_t* str, size_t n_bytes, size_t n_chars, bool copy) { + if (!serd_uri_string_has_scheme(str)) { + return NULL; // Can't intern relative URIs + } + SordNode* node = sord_lookup_name(world, str); if (node) { if (!copy) { -- cgit v1.2.1