potential string handling issue in upnp

This commit is contained in:
Arvid Norberg 2010-10-20 05:14:50 +00:00
parent 517aaf526b
commit 9b50acbe15
1 changed files with 2 additions and 1 deletions

View File

@ -383,12 +383,13 @@ void upnp::on_reply(udp::endpoint const& from, char* buffer
}
else
{
char msg[200];
char msg[400];
int num_chars = snprintf(msg, sizeof(msg), "ignoring response from: %s: IP is not a router. "
, print_endpoint(from).c_str());
for (std::vector<ip_route>::const_iterator i = routes.begin()
, end(routes.end()); i != end; ++i)
{
if (num_chars >= sizeof(msg)-1) break;
num_chars += snprintf(msg + num_chars, sizeof(msg) - num_chars, "(%s,%s) "
, print_address(i->gateway).c_str(), print_address(i->netmask).c_str());
}