Possible bug in icmp-ping.c

PAPADOPOULOS ORFANOS Dimitri dimitri.papadopoulos at cea.fr
Fri Nov 6 04:43:14 PST 2026


Hi,

You might be reading the source code of an old version of ocserv,
before this change was applied:
https://gitlab.com/openconnect/ocserv/-/commit/a307bda153ff10090f166f6fc980d1756b7720f3

Le jeudi 05 novembre 2026 à 11:41 +0100, Paul Courbis de Bridiers de
Villemor a écrit :
> 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


More information about the openconnect-devel mailing list