mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-10 23:08:07 +00:00
Stratum: extract_sockaddr: Truncate overlong addresses rather than stack overflow
Thanks to Mick Ayzenberg <mick@dejavusecurity.com> for finding this!
This commit is contained in:
parent
bac5831b35
commit
b65574bef2
7
util.c
7
util.c
@ -1219,6 +1219,13 @@ bool extract_sockaddr(char *url, char **sockaddr_url, char **sockaddr_port)
|
|||||||
|
|
||||||
if (url_len < 1)
|
if (url_len < 1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (url_len >= sizeof(url_address))
|
||||||
|
{
|
||||||
|
applog(LOG_WARNING, "%s: Truncating overflowed address '%.*s'",
|
||||||
|
__func__, url_len, url_begin);
|
||||||
|
url_len = sizeof(url_address) - 1;
|
||||||
|
}
|
||||||
|
|
||||||
sprintf(url_address, "%.*s", url_len, url_begin);
|
sprintf(url_address, "%.*s", url_len, url_begin);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user