mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
uri_parser: check if uri is long enough to even contain a ://
Before attempting to access these characters. This fixes an out-of-bounds read on the provided URI buffer.
This commit is contained in:
parent
d6e43fd07a
commit
333572e091
@ -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;
|
||||
|
@ -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];
|
||||
|
Loading…
Reference in New Issue
Block a user