diff options
author | David Robillard <d@drobilla.net> | 2017-06-29 12:21:09 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2017-06-29 12:21:09 -0400 |
commit | 195e4bcff3c4dfd3fe8bbf0df57d53ce89ca99e8 (patch) | |
tree | 952b067c7ace8afb1f78cb51ac032d18565c94a8 /src/uri.c | |
parent | 21211d73053d0a66a1da601472c68598cfc53595 (diff) | |
download | serd-195e4bcff3c4dfd3fe8bbf0df57d53ce89ca99e8.tar.gz serd-195e4bcff3c4dfd3fe8bbf0df57d53ce89ca99e8.tar.bz2 serd-195e4bcff3c4dfd3fe8bbf0df57d53ce89ca99e8.zip |
Fix strict parsing of abolute URI schemes
Diffstat (limited to 'src/uri.c')
-rw-r--r-- | src/uri.c | 12 |
1 files changed, 4 insertions, 8 deletions
@@ -103,16 +103,12 @@ serd_uri_string_has_scheme(const uint8_t* utf8) if (!utf8 || !is_alpha(utf8[0])) { return false; // Invalid scheme initial character, URI is relative } + for (uint8_t c; (c = *++utf8) != '\0';) { - switch (c) { - case ':': + if (!is_uri_scheme_char(c)) { + return false; + } else if (c == ':') { return true; // End of scheme - case '+': case '-': case '.': - break; // Valid scheme character, continue - default: - if (!is_alpha(c) && !is_digit(c)) { - return false; // Invalid scheme character - } } } |