talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 507ce6782cdb711b4c41d36c884b8d2ca48cb29a
parent 8866fc11593241e97786a61ce129fe0c10403ee7
Author: Olaf Hering <olaf@aepfle.de>
Date:   Fri, 12 Apr 2024 16:38:43 +0200

Fix bug 4786 "remove type confusion in getsockopt call in sock_connect_async_cb"

The function getsockopt expects a pointer to an area of memory whose
length has to specified in a variable of type socklen_t.

Adjust the type of optlen to be socklen_t as mandated by POSIX.

Adjust the type of optval pointer to what it really is, it will be
automatically converted to become a void * pointer.

Signed-off-by: Olaf Hering <olaf@aepfle.de>

Diffstat:
Msrc/common/socket.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/common/socket.c b/src/common/socket.c @@ -709,7 +709,7 @@ static gboolean sock_connect_async_cb(GIOChannel *source, SockConnectData *conn_data = (SockConnectData *)data; gint fd; gint val; - guint len; + socklen_t len; SockInfo *sockinfo; if (conn_data->io_tag == 0 && conn_data->channel == NULL) @@ -722,7 +722,7 @@ static gboolean sock_connect_async_cb(GIOChannel *source, g_io_channel_unref(source); len = sizeof(val); - if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (void*)&val, &len) < 0) { + if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &val, &len) < 0) { perror("getsockopt"); close(fd); sock_connect_address_list_async(conn_data);