1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

Merge pull request #15930 from nmeum/pr/uri_parser_scheme

uri_parser: check if uri is long enough to even contain a ://
This commit is contained in:
Cenk Gündoğan 2021-02-05 13:23:43 +01:00 committed by GitHub
commit 07f1254d85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -55,7 +55,7 @@ static char *_consume_scheme(uri_parser_result_t *result, char *uri,
result->scheme_len = p - uri;
/* check if authority part exists '://' */
if ((p[1] != '\0') && (p[2] != '\0') && (p[1] == '/') && (p[2] == '/')) {
if (((uri_end - p) > 2) && (p[1] == '/') && (p[2] == '/')) {
*has_authority = true;
/* skip '://' */
return p + 3;

View File

@ -401,6 +401,17 @@ static const validate_t validate_uris[] = {
"./this:that",
"",
0),
VEC("pP://",
true,
"pP",
"",
"",
"",
"",
"",
"",
"",
0),
};
static char _failure_msg[VEC_MSG_LEN];