From abc1cb17cafaba2f4351772184af3de23a3c1037 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cenk=20G=C3=BCndo=C4=9Fan?= Date: Wed, 1 Apr 2020 11:10:09 +0200 Subject: [PATCH] sys/uri_parser: initialize has_authority in _consume_scheme() --- sys/uri_parser/uri_parser.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/uri_parser/uri_parser.c b/sys/uri_parser/uri_parser.c index cc2031f120..228bc6d058 100644 --- a/sys/uri_parser/uri_parser.c +++ b/sys/uri_parser/uri_parser.c @@ -38,7 +38,9 @@ static char *_consume_scheme(uri_parser_result_t *result, char *uri, char *uri_end, bool *has_authority) { assert(uri); - assert(!has_authority); + + /* assume no authority section first */ + *has_authority = false; /* cannot have empty scheme */ if (uri[0] == ':') { @@ -186,7 +188,7 @@ static int _parse_relative(uri_parser_result_t *result, char *uri, static int _parse_absolute(uri_parser_result_t *result, char *uri, char *uri_end) { - bool has_authority = false; + bool has_authority; uri = _consume_scheme(result, uri, uri_end, &has_authority); if (uri == NULL) {