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:
parent
d93ecab880
commit
bff8694051
@ -137,6 +137,9 @@ int sock_urlsplit(const char *url, char *hostport, char *urlpath)
|
|||||||
|
|
||||||
size_t pathlen = strlen(pathstart);
|
size_t pathlen = strlen(pathstart);
|
||||||
if (pathlen) {
|
if (pathlen) {
|
||||||
|
if (pathlen > SOCK_URLPATH_MAXLEN - 1) {
|
||||||
|
return -EOVERFLOW;
|
||||||
|
}
|
||||||
memcpy(urlpath, pathstart, pathlen);
|
memcpy(urlpath, pathstart, pathlen);
|
||||||
}
|
}
|
||||||
*(urlpath + pathlen) = '\0';
|
*(urlpath + pathlen) = '\0';
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user