Ticket #7790: socket_ops.ipp_patch

File socket_ops.ipp_patch, 757 bytes (added by Gaurav Gupta <g.gupta@…>, 10 years ago)

Fix for length validation.

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