From d0345f10595fc0db032986789483ff39e23c98ec Mon Sep 17 00:00:00 2001 From: Jeremy Sowden Date: Fri, 28 Jun 2019 16:11:20 +0100 Subject: [PATCH] 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 --- wmbiff/wmbiff/socket.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wmbiff/wmbiff/socket.c b/wmbiff/wmbiff/socket.c index eca1d36..908fbcd 100644 --- a/wmbiff/wmbiff/socket.c +++ b/wmbiff/wmbiff/socket.c @@ -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;