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

sock_util: check path length in urlsplit

Add a length check to the path to ensure that it fits in the supplied
buffer in the urlsplit function
This commit is contained in:
Koen Zandberg 2018-07-18 15:19:47 +02:00
parent d93ecab880
commit bff8694051
No known key found for this signature in database
GPG Key ID: 0895A893E6D2985B

View File

@ -137,6 +137,9 @@ int sock_urlsplit(const char *url, char *hostport, char *urlpath)
size_t pathlen = strlen(pathstart);
if (pathlen) {
if (pathlen > SOCK_URLPATH_MAXLEN - 1) {
return -EOVERFLOW;
}
memcpy(urlpath, pathstart, pathlen);
}
*(urlpath + pathlen) = '\0';