Possible bug in icmp-ping.c

Paul Courbis de Bridiers de Villemor paul at courbis.fr
Thu Nov 5 02:41:05 PST 2026


Hi everybody

In icmp-ping.c I see this code :

        while (sendto(pingsock, packet1, DEFDATALEN + ICMP_MINLEN, 0,
                      (struct sockaddr *) addr1,
                      sizeof(*addr1) == -1) && retry(errno));

.../...

        while (sendto(pingsock, packet1,
                      DEFDATALEN + sizeof(struct icmp6_hdr), 0,
                      (struct sockaddr *) addr1,
                      sizeof(*addr1) == -1) && retry(errno));

In both cases the 6th arg of "sendto" is sizeof(*addr1) == -1

Sendto manual page indicates that it should be socklen_t addrlen BUT
sizeof(*addr1) == -1 will return 0. I think the closing parenthesis
should be just after sizeof(*addr1) :

        while (sendto(pingsock, packet1, DEFDATALEN + ICMP_MINLEN, 0,
                      (struct sockaddr *) addr1,
                      sizeof(*addr1)) == -1 && retry(errno));

.../...

        while (sendto(pingsock, packet1,
                      DEFDATALEN + sizeof(struct icmp6_hdr), 0,
                      (struct sockaddr *) addr1,
                      sizeof(*addr1)) == -1 && retry(errno));

But I'm not an expert

regards
-- 
Paul Courbis de Bridiers de Villemor



More information about the openconnect-devel mailing list