Browse Source

Stratum: extract_sockaddr: Truncate overlong addresses rather than stack overflow

Thanks to Mick Ayzenberg <mick@dejavusecurity.com> for finding this!
djm34
Luke Dashjr 11 years ago committed by Noel Maersk
parent
commit
91d29ea972
  1. 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);
if (port_len) { if (port_len) {

Loading…
Cancel
Save