This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug admin/7084] New: fix the total number of ip addrs in Router Header type 0 in inet6_rth_reverse()
- From: "shanwei at cn dot fujitsu dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 9 Dec 2008 06:38:59 -0000
- Subject: [Bug admin/7084] New: fix the total number of ip addrs in Router Header type 0 in inet6_rth_reverse()
- Reply-to: sourceware-bugzilla at sourceware dot org
The inet6_rth_reverse() is used to reverse the order of the addresses
in the new Routing header, but the total number of ip addrs is miscalculated.
The initial value of segment left is equal to the value of
"ip6r0_len * 8 / sizeof (struct in6_addr)", and the segment left
will decrease to zero until the packet reach the destination.
So, the total ip addrs is equal to "ip6r0_len * 8 / sizeof (struct in6_addr)",
not "ip6r0_segleft * 8 / sizeof (struct in6_addr)" or "ip6r0_segleft".
Signed-off-by: Shan Wei <shanwei@cn.fujitsu.com>
---
inet/inet6_rth.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/inet/inet6_rth.c b/inet/inet6_rth.c
index 15f8240..a11ba20 100644
--- a/inet/inet6_rth.c
+++ b/inet/inet6_rth.c
@@ -127,7 +127,7 @@ inet6_rth_reverse (const void *in, void *out)
/* Copy header, not the addresses. The memory regions can overlap. */
memmove (out_rthdr0, in_rthdr0, sizeof (struct ip6_rthdr0));
- int total = in_rthdr0->ip6r0_segleft * 8 / sizeof (struct in6_addr);
+ int total = in_rthdr0->ip6r0_len * 8 / sizeof (struct in6_addr);
for (int i = 0; i < total / 2; ++i)
{
/* Remember, IN_RTHDR0 and OUT_RTHDR0 might overlap. */
--
Summary: fix the total number of ip addrs in Router Header type 0
in inet6_rth_reverse()
Product: glibc
Version: 2.8
Status: NEW
Severity: normal
Priority: P2
Component: admin
AssignedTo: roland at gnu dot org
ReportedBy: shanwei at cn dot fujitsu dot com
CC: glibc-bugs at sources dot redhat dot com,shanwei at cn
dot fujitsu dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=7084
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.