1
0
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:
Koen Zandberg 2018-07-18 14:34:54 +02:00
parent b0309145f0
commit 3402e3509c
No known key found for this signature in database
GPG Key ID: 0895A893E6D2985B

View File

@ -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;
} }