This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: (usagi-core 00349) Re: getnameinfo()
In article <m366lwlp0i.fsf@otr.mynet.cygnus.com> (at 09 Nov 2000 15:11:25 -0800), Ulrich Drepper <drepper@redhat.com> says:
> I'm using openssh 2.2.0p1 with glibc 2.1.94 and all is fine. It's
> anyway too late for 2.2 now.
My report for getnameinfo() bugs is not for the first time.
1. bugs in scope_id support was submitted to the GNATS long time ago.
Code I submitted should have been correct, but you broke it.
I addressed the problem, but you ignored my reports (or me :-p).
2. did you receive these reports dated September 27th, didn't you?
(These reports were not perfect, though.)
If the bug reporting system had been down, you would have had to warn.
--
Hideaki YOSHIFUJI @ USAGI Project <yoshfuji@linux-ipv6.org>
PGP5i FP: F731 6599 5EB2 BBA7 1515 1323 1806 A96F 5700 6B25
- To: bugs at gnu dot org
- Subject: [USERS 359] getnameinfo() NI_NUMERICSCOPE flag support
- From: yoshfuji at linux-ipv6 dot org
- Date: Wed, 27 Sep 2000 20:04:28 +0900
- CC: users at jp dot ipv6 dot org
- Reply-To: users at jp dot ipv6 dot org
>Submitter-Id: net
>Originator: YOSHIFUJI Hideaki
>Organization:
USAGI Project / linux-ipv6.org
>Confidential: no
>Synopsis: getnameinfo() NI_NUMERICSCOPE support.
>Severity: non-critical
>Priority: medium
>Category: libc
>Class: support
>Release: libc-2.x (CVS)
>Environment:
Host type: i386-pc-linux-gnu
System: Linux cerberus 2.2.16 #17 Fri Aug 4 11:33:10 JST 2000 i586 unknown
Architecture: i586
Addons: crypt linuxthreads nss-v1
Build CC: gcc
Compiler version: 2.95.2 20000220 (Debian GNU/Linux)
Kernel headers: UTS_RELEASE
Symbol versioning: yes
Build static: yes
Build shared: yes
Build pic-default: no
Build profile: yes
Build omitfp: no
Build bounded: no
Build static-nss: no
Stdio: libio
>Description:
NI_NUMERICSCOPE support as defined in RFC2553bis.
>How-To-Repeat:
>Fix:
With this patch introduces NI_NUMERICSCOPE as defined in RFC2552bis.
--- resolv/netdb.h Wed Aug 2 00:00:40 2000
+++ netdb.h Wed Sep 27 17:41:27 2000
@@ -432,11 +432,12 @@
# define NI_MAXHOST 1025
# define NI_MAXSERV 32
-# define NI_NUMERICHOST 1 /* Don't try to look up hostname. */
-# define NI_NUMERICSERV 2 /* Don't convert port number to name. */
-# define NI_NOFQDN 4 /* Only return nodename portion. */
-# define NI_NAMEREQD 8 /* Don't return numeric addresses. */
-# define NI_DGRAM 16 /* Look up UDP service rather than TCP. */
+# define NI_NUMERICHOST 0x01 /* Don't try to look up hostname. */
+# define NI_NUMERICSERV 0x02 /* Don't convert port number to name. */
+# define NI_NOFQDN 0x04 /* Only return nodename portion. */
+# define NI_NAMEREQD 0x08 /* Don't return numeric addresses. */
+# define NI_DGRAM 0x10 /* Look up UDP service rather than TCP. */
+# define NI_NUMERICSCOPE 0x20 /* Don't try to look up scope id. */
/* Translate name of a service location and/or a service name to set of
socket addresses. */
--- inet/getnameinfo.c Wed Sep 27 19:39:43 2000
+++ getnameinfo.c Wed Sep 27 19:59:38 2000
@@ -302,8 +302,9 @@
char scopebuf[IFNAMSIZ + 1];
int ni_numericscope = 0;
- if (IN6_IS_ADDR_LINKLOCAL (&sin6p->sin6_addr)
- || IN6_IS_ADDR_MC_LINKLOCAL (&sin6p->sin6_addr))
+ if (!ni_numericscope &&
+ (IN6_IS_ADDR_LINKLOCAL (&sin6p->sin6_addr)
+ || IN6_IS_ADDR_MC_LINKLOCAL (&sin6p->sin6_addr)))
{
if (if_indextoname (scopeid, scopebuf) == NULL)
++ni_numericscope;
===---===---===---===
Get help : send mail to ppserv@jp.ipv6.org, body is "help", no subject.
unsubscribe: send mail to ppserv@jp.ipv6.org, body is "unsubscribe", no subject.
- To: bugs at gnu dot org
- Subject: [USERS 360] IF_NAMESIZE is missing in net/if.h
- From: yoshfuji at linux-ipv6 dot org
- Date: Wed, 27 Sep 2000 20:08:36 +0900
- CC: users at jp dot ipv6 dot org
- Reply-To: users at jp dot ipv6 dot org
>Submitter-Id: net
>Originator: YOSHIFUJI Hideaki
>Organization:
USAGI Project / linux-ipv6.org
>Confidential: no
>Synopsis: IF_NAMESIZE defined in RFC2553 is missing in net/if.h
>Severity: serious
>Priority: high
>Category: libc
>Class: sw-bug
>Release: libc-2.x (CVS)
>Environment:
Host type: i386-pc-linux-gnu
System: Linux cerberus 2.2.16 #17 Fri Aug 4 11:33:10 JST 2000 i586 unknown
Architecture: i586
Addons: crypt linuxthreads nss-v1
Build CC: gcc
Compiler version: 2.95.2 20000220 (Debian GNU/Linux)
Kernel headers: UTS_RELEASE
Symbol versioning: yes
Build static: yes
Build shared: yes
Build pic-default: no
Build profile: yes
Build omitfp: no
Build bounded: no
Build static-nss: no
Stdio: libio
>Description:
RFC2553's IF_NAMESIZE is missing in net/if.h
>How-To-Repeat:
>Fix:
--- sysdeps/gnu/net/if.h Sat Aug 19 00:01:15 2000
+++ if.h Wed Sep 27 18:50:05 2000
@@ -112,6 +112,7 @@
{
#define IFHWADDRLEN 6
#define IFNAMSIZ 16
+#define IF_NAMESIZE IFNAMSIZ
union
{
char ifrn_name[IFNAMSIZ]; /* Interface name, e.g. "en0". */
===---===---===---===
Get help : send mail to ppserv@jp.ipv6.org, body is "help", no subject.
unsubscribe: send mail to ppserv@jp.ipv6.org, body is "unsubscribe", no subject.
- To: bugs at gnu dot org
- Subject: [USERS 361] getaddrinfo() does not allow PF_INET6/SOCK_RAW/IPPROTO_ICMPV6 set
- From: yoshfuji at linux-ipv6 dot org
- Date: Wed, 27 Sep 2000 20:17:35 +0900
- CC: users at jp dot ipv6 dot org
- Reply-To: users at jp dot ipv6 dot org
>Submitter-Id: net
>Originator: YOSHIFUJI Hideaki
>Organization:
USAGI Project / linux-ipv6.org
>Confidential: no
>Synopsis: getaddrinfo() does not allow PF_INET6/SOCK_RAW/IPPROTO_ICMPV6 set
>Severity: serious
>Priority: high
>Category: libc
>Class: sw-bug
>Release: libc-2.x (CVS)
>Environment:
Host type: i386-pc-linux-gnu
System: Linux cerberus 2.2.16 #17 Fri Aug 4 11:33:10 JST 2000 i586 unknown
Architecture: i586
Addons: crypt linuxthreads nss-v1
Build CC: gcc
Compiler version: 2.95.2 20000220 (Debian GNU/Linux)
Kernel headers: UTS_RELEASE
Symbol versioning: yes
Build static: yes
Build shared: yes
Build pic-default: no
Build profile: yes
Build omitfp: no
Build bounded: no
Build static-nss: no
Stdio: libio
>Description:
getaddrinfo() won't accept PF_INET6 / SOCK_RAW / IPPROTO_ICMPV6 set.
In fact, for PF_INET6 / SOCK_RAW set, it accepts only IPPROTO_RAW protocol.
It should accept other protocols such as IPPROTO_ICMPV6, too.
>How-To-Repeat:
>Fix:
--- sysdeps/posix/getaddrinfo.c Fri Sep 1 00:01:09 2000
+++ getaddrinfo.c Wed Sep 27 16:37:01 2000
@@ -99,13 +99,14 @@
/* Values for `protoflag'. */
#define GAI_PROTO_NOSERVICE 1
+#define GAI_PROTO_PROTOANY 2
static struct gaih_typeproto gaih_inet_typeproto[] =
{
{ 0, 0, NULL, 0 },
{ SOCK_STREAM, IPPROTO_TCP, (char *) "tcp", 0 },
{ SOCK_DGRAM, IPPROTO_UDP, (char *) "udp", 0 },
- { SOCK_RAW, IPPROTO_RAW, (char *) "raw", GAI_PROTO_NOSERVICE },
+ { SOCK_RAW, 0, (char *) "raw", GAI_PROTO_PROTOANY|GAI_PROTO_NOSERVICE },
{ 0, 0, NULL, 0 }
};
@@ -150,6 +151,7 @@
&& ((tp->protoflag & GAI_PROTO_NOSERVICE) != 0
|| (req->ai_socktype != 0 && req->ai_socktype != tp->socktype)
|| (req->ai_protocol != 0
+ && !(tp->protoflag & GAI_PROTO_PROTOANY)
&& req->ai_protocol != tp->protocol)))
++tp;
@@ -311,6 +313,7 @@
while (tp->name != NULL
&& ((req->ai_socktype != 0 && req->ai_socktype != tp->socktype)
|| (req->ai_protocol != 0
+ && !(tp->protoflag & GAI_PROTO_PROTOANY)
&& req->ai_protocol != tp->protocol)))
++tp;
===---===---===---===
Get help : send mail to ppserv@jp.ipv6.org, body is "help", no subject.
unsubscribe: send mail to ppserv@jp.ipv6.org, body is "unsubscribe", no subject.
- To: bugs at gnu dot org
- Subject: [USERS 358] getnameinfo() with scope_id
- From: yoshfuji at linux-ipv6 dot org
- Date: Wed, 27 Sep 2000 19:55:30 +0900
- CC: users at jp dot ipv6 dot org
- Reply-To: users at jp dot ipv6 dot org
>Submitter-Id: net
>Originator: YOSHIFUJI Hideaki
>Organization:
USAGI Project / linux-ipv6.org
>Confidential: no
>Synopsis: getnameinfo() does not work correctly with scope-id.
>Severity: serious
>Priority: high
>Category: libc
>Class: sw-bug
>Release: libc-2.x (CVS)
>Environment:
Host type: i386-pc-linux-gnu
System: Linux cerberus 2.2.16 #17 Fri Aug 4 11:33:10 JST 2000 i586 unknown
Architecture: i586
Addons: crypt linuxthreads nss-v1
Build CC: gcc
Compiler version: 2.95.2 20000220 (Debian GNU/Linux)
Kernel headers: UTS_RELEASE
Symbol versioning: yes
Build static: yes
Build shared: yes
Build pic-default: no
Build profile: yes
Build omitfp: no
Build bounded: no
Build static-nss: no
Stdio: libio
>Description:
getnameinfo() does not work correctly.
1. We should allow users to run old binaries without scope-id.
note: linux-kernel allow old binaries. (1st and 2nd chunk)
2. scope-id support was 'dead'.
even if it were alive, it would be wrong. (3rd, 4th and 5th chunk)
>How-To-Repeat:
/*
* Copyright (C)2000 Hideaki YOSHIFUJI / USAGI Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the author, project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR, PROJECT AND CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR, PROJECT OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
/* gnitest_nasty.c
*
* this test program check whether getnameinfo() work with / without scope id;
* both version should be allowed.
*/
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <net/if.h>
#include <netdb.h>
struct __sockaddr_in6_rfc2133
{
__SOCKADDR_COMMON (sin6_);
uint16_t sin6_port;
uint32_t sin6_flowinfo;
struct in6_addr sin6_addr;
};
#ifdef NEED_SOCKADDR_IN6_RFC2553
struct __sockaddr_in6_rfc2553
{
__SOCKADDR_COMMON (sin6_);
uint16_t sin6_port;
uint32_t sin6_flowinfo;
struct in6_addr sin6_addr;
uint32_t sin6_scope_id;
};
#endif
#define IN6ADDR "ff02::1"
#define IFNAME "eth0"
#define _SCOPE_DELIMITER "%"
int main(){
struct __sockaddr_in6_rfc2133 sin6_rfc2133;
#ifndef NEED_SOCKADDR_IN6_RFC2553
struct sockaddr_in6 sin6_rfc2553;
#else
struct __sockaddr_in6_rfc2553 sin6_rfc2553;
#endif
int ifindex;
int res;
char hbuf[NI_MAXHOST];
ifindex = if_nametoindex(IFNAME);
if (!ifindex){
fprintf(stderr, "Panic: define IFNAME correctly\n", IFNAME);
exit(4);
}
/* fill RFC2133 sockaddr_in6 */
memset(&sin6_rfc2133, 0, sizeof(sin6_rfc2133));
sin6_rfc2133.sin6_family = AF_INET6;
#ifdef SIN6_LEN
sin6_rfc2133.sin6_len = sizeof(sin6_rfc2133);
#endif
res = inet_pton(AF_INET6, IN6ADDR, &sin6_rfc2133.sin6_addr);
if (!res){
fprintf(stderr, "Panic: inet_pton() failed.\n");
exit(4);
}
/* fill RFC2553 sockaddr_in6 */
memset(&sin6_rfc2553, 0, sizeof(sin6_rfc2553));
sin6_rfc2553.sin6_family = sin6_rfc2133.sin6_family;
#ifdef SIN6_LEN
sin6_rfc2553.sin6_len = sin6_rfc2133.sin6_len;
#endif
sin6_rfc2553.sin6_addr = sin6_rfc2133.sin6_addr;
sin6_rfc2553.sin6_scope_id = ifindex;
/* print result */
res = getnameinfo((struct sockaddr *)&sin6_rfc2133, sizeof(sin6_rfc2133),
hbuf, sizeof(hbuf), NULL, 0,
NI_NUMERICHOST);
if (res){
printf("getnameinfo() for OLD sockaddr_in6{} FAILED: ret = %d\n", res);
}
else{
printf("getnameinfo() for OLD sockaddr_in6{} succeeded: name=%s\n", hbuf);
if (strcmp(hbuf, IN6ADDR) != 0){
printf(" - but, result should be \"%s\"\n", IN6ADDR);
}
}
res = getnameinfo((struct sockaddr *)&sin6_rfc2553, sizeof(sin6_rfc2553),
hbuf, sizeof(hbuf), NULL, 0,
NI_NUMERICHOST);
if (res){
printf("getnameinfo() for NEW sockaddr_in6{} FAILED: ret = %d\n", res);
}
else{
printf("getnameinfo() for NEW sockaddr_in6{} succeeded: name=%s\n", hbuf);
if (strcmp(hbuf, IN6ADDR _SCOPE_DELIMITER IFNAME) != 0){
printf(" - result should be \"%s\"\n", IN6ADDR _SCOPE_DELIMITER IFNAME);
}
}
exit(0);
}
>Fix:
1. We should allow users to run old binaries without scope-id.
note: linux-kernel allow old binaries. (1st and 2nd chunk)
2. scope-id support was 'dead'.
even if it were alive, it would be wrong. (3rd, 4th and 5th chunk)
--- /pub/cvs/libc/inet/getnameinfo.c Sun Apr 2 17:25:58 2000
+++ getnameinfo.c Wed Sep 27 19:37:58 2000
@@ -63,6 +63,18 @@
#endif /* min */
+/*
+ * RFC2133 defines sockaddr_in6 without sin6_scope_id.
+ */
+struct __sockaddr_in6_rfc2133
+ {
+ __SOCKADDR_COMMON (sin6_);
+ uint16_t sin6_port; /* Transport layer port # */
+ uint32_t sin6_flowinfo; /* IPv6 flow information */
+ struct in6_addr sin6_addr; /* IPv6 address */
+ };
+
+
static char *
internal_function
nrl_domainname (void)
@@ -189,7 +201,11 @@
return -1;
break;
case AF_INET6:
- if (addrlen < sizeof (struct sockaddr_in6))
+ /*
+ * glibc 2.1.x and linux-2.2.x are based on old spec (RFC2133).
+ * We should allow users to run old binaries.
+ */
+ if (addrlen < sizeof (struct __sockaddr_in6_rfc2133))
return -1;
break;
default:
@@ -295,18 +311,25 @@
c = inet_ntop (AF_INET6,
(void *) &sin6p->sin6_addr, host, hostlen);
- if (addrlen > sizeof (struct sockaddr_in6)
+ if (addrlen >= sizeof (struct sockaddr_in6)
&& (scopeid = sin6p->sin6_scope_id))
{
/* Buffer is >= IFNAMSIZ+1. */
char scopebuf[IFNAMSIZ + 1];
int ni_numericscope = 0;
+ size_t real_hostlen = __strnlen(host, hostlen);
+ size_t scopelen = 0;
if (IN6_IS_ADDR_LINKLOCAL (&sin6p->sin6_addr)
|| IN6_IS_ADDR_MC_LINKLOCAL (&sin6p->sin6_addr))
{
- if (if_indextoname (scopeid, scopebuf) == NULL)
+ if (if_indextoname (scopeid, &scopebuf[1]) == NULL)
++ni_numericscope;
+ else
+ {
+ scopebuf[0] = SCOPE_DELIMITER;
+ scopelen = __strnlen(scopebuf, sizeof(scopebuf));
+ }
}
else
++ni_numericscope;
@@ -314,8 +337,6 @@
if (ni_numericscope)
{
char *scopeptr = &scopebuf[1];
- size_t real_hostlen;
- size_t scopelen;
scopebuf[0] = SCOPE_DELIMITER;
scopelen = 1 + snprintf (scopeptr,
@@ -323,12 +344,10 @@
+ sizeof scopebuf
- scopeptr),
"%u", scopeid);
-
- real_hostlen = __strnlen (host, hostlen);
- if (real_hostlen + scopelen + 1 > hostlen)
- return -1;
- memcpy (host + real_hostlen, scopebuf, scopelen);
}
+ if (real_hostlen + scopelen + 1 > hostlen)
+ return -1;
+ memcpy (host + real_hostlen, scopebuf, scopelen);
}
}
else
===---===---===---===
Get help : send mail to ppserv@jp.ipv6.org, body is "help", no subject.
unsubscribe: send mail to ppserv@jp.ipv6.org, body is "unsubscribe", no subject.
- To: bugs at gnu dot org
- Subject: [USERS 362] CMSG_NXTHDR(msgh,NULL) support
- From: yoshfuji at linux-ipv6 dot org
- Date: Wed, 27 Sep 2000 20:23:37 +0900
- CC: users at jp dot ipv6 dot org
- Reply-To: users at jp dot ipv6 dot org
>Submitter-Id: net
>Originator: YOSHIFUJI Hideaki
>Organization:
USAGI Project / linux-ipv6.org
>Confidential: no
>Synopsis: CMSG_NXTHDR(msgh,NULL) support
>Severity: non-critical
>Priority: medium
>Category: libc
>Class: support
>Release: libc-2.x (CVS)
>Environment:
Host type: i386-pc-linux-gnu
System: Linux cerberus 2.2.16 #17 Fri Aug 4 11:33:10 JST 2000 i586 unknown
Architecture: i586
Addons: crypt linuxthreads nss-v1
Build CC: gcc
Compiler version: 2.95.2 20000220 (Debian GNU/Linux)
Kernel headers: UTS_RELEASE
Symbol versioning: yes
Build static: yes
Build shared: yes
Build pic-default: no
Build profile: yes
Build omitfp: no
Build bounded: no
Build static-nss: no
Stdio: libio
>Description:
CMSG_NXTHDR(msgh,NULL) should return CMSG_FIRSTHDR(msgh)
(RFC2553).
>How-To-Repeat:
>Fix:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
This patch introduce RFC2292 / RFC2292bis extension:
if msgh == NULL, do CMSG_FIRSTHDR().
--- sysdeps/unix/sysv/linux/cmsg_nxthdr.c Wed Nov 18 22:21:15 1998
+++ cmsg_nxthdr.c Wed Sep 27 16:22:12 2000
@@ -23,6 +23,9 @@
struct cmsghdr *
__cmsg_nxthdr (struct msghdr *mhdr, struct cmsghdr *cmsg)
{
+ if (cmsg == NULL)
+ return CMSG_FIRSTHDR(mhdr);
+
if ((size_t) cmsg->cmsg_len < sizeof (struct cmsghdr))
/* The kernel header does this so there may be a reason. */
return NULL;
===---===---===---===
Get help : send mail to ppserv@jp.ipv6.org, body is "help", no subject.
unsubscribe: send mail to ppserv@jp.ipv6.org, body is "unsubscribe", no subject.
- To: bugs at gnu dot org
- Subject: [USERS 363] last ancillary data may / may not have trailing pad
- From: yoshfuji at linux-ipv6 dot org
- Date: Wed, 27 Sep 2000 20:31:30 +0900
- CC: users at jp dot ipv6 dot org
- Reply-To: users at jp dot ipv6 dot org
>Submitter-Id: net
>Originator: YOSHIFUJI Hideaki
>Organization:
USAGI Project / linux-ipv6.org
>Confidential: no
>Synopsis: CMSG_NXTHDR does not allow ancillary data object without pad.
>Severity: critical
>Priority: high
>Category: libc
>Class: sw-bug
>Release: libc-2.x (CVS)
>Environment:
Host type: i386-pc-linux-gnu
System: Linux cerberus 2.2.16 #17 Fri Aug 4 11:33:10 JST 2000 i586 unknown
Architecture: i586
Addons: crypt linuxthreads nss-v1
Build CC: gcc
Compiler version: 2.95.2 20000220 (Debian GNU/Linux)
Kernel headers: UTS_RELEASE
Symbol versioning: yes
Build static: yes
Build shared: yes
Build pic-default: no
Build profile: yes
Build omitfp: no
Build bounded: no
Build static-nss: no
Stdio: libio
>Description:
Linux kernel do not send the last pad.
The lates spec allow this behavior; the last acillary
data element may / may not have trailing "pad".
RFC2292bis:
|<--------------------------- msg_controllen -------------------------->|
| OR |
|<--------------------------- msg_controllen ----------------------->|
| |
|<----- ancillary data object ----->|<----- ancillary data object ----->|
|<------ min CMSG_SPACE() --------->|<------ min CMSG_SPACE() --------->|
| | |
|<---------- cmsg_len ---------->| |<--------- cmsg_len ----------->| |
|<--------- CMSG_LEN() --------->| |<-------- CMSG_LEN() ---------->| |
| | | | |
+-----+-----+-----+--+-----------+--+-----+-----+-----+--+-----------+--+
|cmsg_|cmsg_|cmsg_|XX| |XX|cmsg_|cmsg_|cmsg_|XX| |XX|
|len |level|type |XX|cmsg_data[]|XX|len |level|type |XX|cmsg_data[]|XX|
+-----+-----+-----+--+-----------+--+-----+-----+-----+--+-----------+--+
^
|
msg_control
points here
>How-To-Repeat:
>Fix:
--- sysdeps/unix/sysv/linux/cmsg_nxthdr.c Wed Nov 18 22:21:15 1998
+++ cmsg_nxthdr.c Wed Sep 27 16:21:07 2000
@@ -31,7 +31,7 @@
+ CMSG_ALIGN (cmsg->cmsg_len));
if ((unsigned char *) (cmsg + 1) >= ((unsigned char *) mhdr->msg_control
+ mhdr->msg_controllen)
- || ((unsigned char *) cmsg + CMSG_ALIGN (cmsg->cmsg_len)
+ || ((unsigned char *) cmsg + cmsg->cmsg_len
>= ((unsigned char *) mhdr->msg_control + mhdr->msg_controllen)))
/* No more entries. */
return NULL;
===---===---===---===
Get help : send mail to ppserv@jp.ipv6.org, body is "help", no subject.
unsubscribe: send mail to ppserv@jp.ipv6.org, body is "unsubscribe", no subject.