From e8a4c1d813f59db3dbec525cdeec08a20bd5cfda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Mon, 30 Oct 2023 12:28:00 +0100 Subject: xfer: fix use of uninitialized variable when adding a new xfer --- src/plugins/xfer/xfer.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/plugins/xfer') diff --git a/src/plugins/xfer/xfer.c b/src/plugins/xfer/xfer.c index d775f7512..314c512b1 100644 --- a/src/plugins/xfer/xfer.c +++ b/src/plugins/xfer/xfer.c @@ -1064,6 +1064,9 @@ xfer_add_cb (const void *pointer, void *data, token = weechat_infolist_string (infolist, "token"); protocol = XFER_NO_PROTOCOL; + memset (&local_addr_storage, 0, sizeof (local_addr_storage)); + local_addr_length = sizeof (local_addr_storage); + if (!plugin_name || !plugin_id || !str_type || !remote_nick || !local_nick) { weechat_printf (NULL, @@ -1234,8 +1237,6 @@ xfer_add_cb (const void *pointer, void *data, { /* no own_ip, so bind_addr's family comes from irc connection */ /* use the local interface, from the server socket */ - memset (&local_addr_storage, 0, sizeof (local_addr_storage)); - local_addr_length = sizeof (local_addr_storage); server_sock = weechat_infolist_integer (infolist, "socket"); if (getsockname (server_sock, (struct sockaddr *)&local_addr_storage, &local_addr_length)) { -- cgit v1.2.3