mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2024-12-04 14:46:30 -05:00
Fix: YP: Improve error handling
In case the url written by client_get_baseurl exceeds the length and the realloc failed, previously the truncated URL would have been used. The error case (ret < 0) was not handled at all before.
This commit is contained in:
parent
7563fe9e52
commit
e534df86f8
11
src/yp.c
11
src/yp.c
@ -600,9 +600,16 @@ static ypdata_t *create_yp_entry (const char *mount)
|
||||
if (ret >= len) {
|
||||
// Buffer was too small, allocate a big enough one
|
||||
s = realloc (url, ret + 1);
|
||||
if (s) url = s;
|
||||
client_get_baseurl(NULL, NULL, url, len, NULL, NULL, NULL, mount, NULL);
|
||||
if (!s) {
|
||||
free(url);
|
||||
break;
|
||||
}
|
||||
url = s;
|
||||
|
||||
ret = client_get_baseurl(NULL, NULL, url, len, NULL, NULL, NULL, mount, NULL);
|
||||
}
|
||||
if (ret < 0 || ret >= len)
|
||||
break;
|
||||
|
||||
config = config_get_config();
|
||||
mountproxy = config_find_mount (config, mount, MOUNT_TYPE_NORMAL);
|
||||
|
Loading…
Reference in New Issue
Block a user