On Mon, Nov 5, 2018 at 12:38 PM Ryota Ozaki <ozak...@netbsd.org> wrote:
>
(snip)
>
> I can reproduce the panic easily by the small program:
>
> // start--
> #include <sys/socket.h>
> #include <netinet/in.h>
> #include <err.h>
>
> int
> main(void)
> {
>         char buf[64];
>         struct sockaddr_storage ss = {0};
>         int s, e;
>
>         ss.ss_family = AF_INET6;
>         ss.ss_len = sizeof(struct sockaddr_in6);

Oops. sin6_addr and sin6_port (of ss casted to sockaddr_in6)
should not be zero and so be set some 1.

  ozaki-r

>         s = socket(AF_INET6, SOCK_DGRAM, 0);
>         e = sendto(s, buf, sizeof(buf), 0, (struct sockaddr *)&ss, ss.ss_len);
>         if (e == -1)
>                 warn("sendto");
>         ss.ss_len = sizeof(ss);
>         e = sendto(s, buf, sizeof(buf), 0, (struct sockaddr *)&ss, ss.ss_len);
>         if (e == -1)
>                 warn("sendto");
> }
> // --end

Reply via email to