diff -Naur a/boost/asio/detail/impl/socket_ops.ipp b/boost/asio/detail/impl/socket_ops.ipp --- a/boost/asio/detail/impl/socket_ops.ipp 2012-07-23 16:33:31.000000000 +0530 +++ b/boost/asio/detail/impl/socket_ops.ipp 2012-12-13 14:59:03.000000000 +0530 @@ -1880,7 +1880,15 @@ && ((ipv6_address->s6_addr[1] & 0xc0) == 0x80)); if (!is_link_local || if_indextoname(scope_id, if_name + 1) == 0) sprintf(if_name + 1, "%lu", scope_id); - strcat(dest, if_name); + + if((strlen(dest)+strlen(if_name)) < length) + strcat(dest, if_name); + else + { + ec = boost::asio::error::invalid_argument; // length is not sufficient + result=0; + } + } return result; #endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)