wmbiff: fixed endianness problems connecting to POP and IMAP servers.

`addr.sin_addr.s_addr` is a `uint32_t` in NBO, so assigning a
`struct in_addr` cast to `unsigned long` will break on 64-bit big-endian
architectures.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
This commit is contained in:
Jeremy Sowden 2019-06-28 16:11:20 +01:00 committed by Carlos R. Mafra
parent dfa571a21b
commit d0345f1059

View file

@ -51,9 +51,9 @@ static int sanity_check_hostname(const char *hostname)
static int ipv4_sock_connect(struct in_addr *address, uint16_t port)
{
struct sockaddr_in addr = {
.sin_family = AF_INET,
.sin_addr.s_addr = *(u_long *) address,
.sin_port = htons(port)
.sin_family = AF_INET,
.sin_addr = *address,
.sin_port = htons(port)
};
struct sockaddr *addrp = (struct sockaddr *) &addr;
socklen_t addrlen = sizeof addr;