about summary refs log tree commit diff
path: root/inet/inet6_rth.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-03-15 19:16:16 +0000
committerUlrich Drepper <drepper@redhat.com>2009-03-15 19:16:16 +0000
commit906dd40db380c58794d252a112bd079b5d5f4dc6 (patch)
treeee74af4be50a937c9e6e7aad1b4184b93abaeca5 /inet/inet6_rth.c
parent71a5bd3e177e7748cf8993b0577d65d8986b44bc (diff)
downloadglibc-906dd40db380c58794d252a112bd079b5d5f4dc6.tar.gz
glibc-906dd40db380c58794d252a112bd079b5d5f4dc6.tar.xz
glibc-906dd40db380c58794d252a112bd079b5d5f4dc6.zip
[BZ #9881]
	* inet/inet6_rth.c (inet6_rth_add): Add some error checking.
	Patch mostly by Yang Hongyang <yanghy@cn.fujitsu.com>.
	* inet/Makefile (tests): Add tst-inet6_rth.
	* inet/tst-inet6_rth.c: New file.

	alignment of La_x86_64_regs.  Store xmm parameters.
Diffstat (limited to 'inet/inet6_rth.c')
-rw-r--r--inet/inet6_rth.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/inet/inet6_rth.c b/inet/inet6_rth.c
index 15f8240909..e0fad339a9 100644
--- a/inet/inet6_rth.c
+++ b/inet/inet6_rth.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2006, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2006.
 
@@ -93,6 +93,9 @@ inet6_rth_add (void *bp, const struct in6_addr *addr)
       struct ip6_rthdr0 *rthdr0;
     case IPV6_RTHDR_TYPE_0:
       rthdr0 = (struct ip6_rthdr0 *) rthdr;
+      if (rthdr0->ip6r0_len * 8 / sizeof (struct in6_addr)
+	  - rthdr0->ip6r0_segleft < 1)
+        return -1;
 
       memcpy (&rthdr0->ip6r0_addr[rthdr0->ip6r0_segleft++],
 	      addr, sizeof (struct in6_addr));