This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/5760] New: inet6_opt_init does not initialize the extension header length correctly


In file inet/inet6_opt.c:
inet6_opt_init (void *extbuf, socklen_t extlen)

What the method should do is written in RFC 3542. 
I tried to set up a hop-by-hop options header
but got errors back from sendmsg(). My findings are
as follows:
RFC 2460 says for HbH Opts and Dest Opts:
Hdr Ext Len          8-bit unsigned integer.  Length of the Hop-by
                     Hop Options header in 8-octet units, not
                     including the first 8 octets.

The problem is now that inet6_opt_init(extbuf, extlen)
with extlen == 8 results in a wrong setting of the
extension header length, because the glibc code sets
extp->ip6h_len = extlen / 8;
which yields 1, but it should be actually 0!
Passing an extlen of 0 is not allowed by the sanity
checks of the method and the RFC requires a _positive_ 
multiple of 8. So constructing a valid IPv6 HbH Opt Extension
header is not possible using the current implementation
of inet6_opt_init().

Fix: extp->ip6h_len = extlen / 8 - 1;

-- 
           Summary: inet6_opt_init does not initialize the extension header
                    length correctly
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: roland at bless dot de
                CC: glibc-bugs at sources dot redhat dot com
  GCC host triplet: linux-i686
GCC target triplet: glibc-2.6-1 and also 2.7


http://sourceware.org/bugzilla/show_bug.cgi?id=5760

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]