diff options
author | Jakub Jelinek <jakub@redhat.com> | 2008-03-14 17:22:27 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2008-03-14 17:22:27 +0000 |
commit | b87b7fc3e6e41cf8006fb2341c236a46f6d8bdd4 (patch) | |
tree | 8b042dd05d766dd46dfa953aec240207eae14208 /inet | |
parent | 5c25449dd9fd706f79ee6d92019f28044d9270fa (diff) |
Updated to fedora-glibc-20080310T1651
Diffstat (limited to 'inet')
-rw-r--r-- | inet/inet6_opt.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/inet/inet6_opt.c b/inet/inet6_opt.c index 17d3fee213..ccf7af5f61 100644 --- a/inet/inet6_opt.c +++ b/inet/inet6_opt.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2006, 2007 Free Software Foundation, Inc. +/* Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2006. @@ -34,12 +34,16 @@ inet6_opt_init (void *extbuf, socklen_t extlen) { if (extbuf != NULL) { - if (extlen <= 0 || (extlen % 8) != 0) + if (extlen <= 0 || (extlen % 8) != 0 || extlen > 256 * 8) return -1; /* Fill in the length in units of 8 octets. */ struct ip6_hbh *extp = (struct ip6_hbh *) extbuf; - extp->ip6h_len = extlen / 8; + + /* RFC 2460 requires that the header extension length is the + length of the option header in 8-byte units, not including + the first 8 bytes. Hence we have to subtract one. */ + extp->ip6h_len = extlen / 8 - 1; } return sizeof (struct ip6_hbh); |