Skip to contentSkip to conversation

IPv6: Fix the data length of get destination options with short length

PATCH New Yang Hongyang 1 participant 1 message May 28, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 IPv6: Fix the data length of get destination options with short length

If get destination options with length which is not enough for that
option,getsockopt() will still return the real length of the option, which is larger then the buffer space.
This is because ipv6_getsockopt_sticky() returns the real length of
the option.

This patch fix this problem.

net/ipv6/ipv6_sockglue.c +1 -1
@@ -832,7 +832,7 @@ static int ipv6_getsockopt_sticky(struct
 	len = min_t(unsigned int, len, ipv6_optlen(hdr));
 	if (copy_to_user(optval, hdr, len))
 		return -EFAULT;
-	return ipv6_optlen(hdr);
+	return len;
 }