mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
sock_util: Prevent overflow in _find_pathstart
Limit the number of scanned chars in _find_pathstart to the predefined size
This commit is contained in:
parent
b0309145f0
commit
3402e3509c
@ -105,8 +105,10 @@ static char* _find_hoststart(const char *url)
|
|||||||
|
|
||||||
static char* _find_pathstart(const char *url)
|
static char* _find_pathstart(const char *url)
|
||||||
{
|
{
|
||||||
|
size_t remaining = SOCK_HOSTPORT_MAXLEN;
|
||||||
char *urlpos = (char*)url;
|
char *urlpos = (char*)url;
|
||||||
while(*urlpos) {
|
while(*urlpos && remaining) {
|
||||||
|
remaining--;
|
||||||
if (*urlpos == '/') {
|
if (*urlpos == '/') {
|
||||||
return urlpos;
|
return urlpos;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user