[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#187391: bug found (in libc)



Robert Millan <zeratul2@wanadoo.es> writes:

> no no please, i'm not asking for a change in sockaddr format.

[...]

> and the bug can be fixed without changing the definition, by just
> applying this:

[...]

>  #define        __SOCKADDR_COMMON(sa_prefix)    \
> -  unsigned char sa_prefix##len;                \
>    sa_family_t sa_prefix##family

But that *is* precisely a change of the sockaddr format. struct
sockaddr (and sockaddr_un, sockaddr_in, etc) are defined in terms of
__SOCKADDR_COMMON. For example,

<bits/socket.h>:

  /* Structure describing a generic socket address.  */
  struct sockaddr
    {
      __SOCKADDR_COMMON (sa_);	/* Common data: address family and length.  */
      char sa_data[14];		/* Address data.  */
    };

<sys/un.h>:

  /* Structure describing the address of an AF_LOCAL (aka AF_UNIX)
  socket.  */
  struct sockaddr_un
    {
      __SOCKADDR_COMMON (sun_);
      char sun_path[108];		/* Path name.  */
    };
  
Changing __SOCKADDR_COMMON changes the definition of all sockaddr*.
That's what that macro is for.

/Niels



Reply to: