From bfb34faa971422a5dd5039995f9f2bd578c6de1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sat, 20 Jun 2026 22:02:49 +0200 Subject: [PATCH] irc: replace "atol" by "atoll" for variables cast to time_t On modern 32-bit platforms with a 64-bit time_t, long is 32-bit but time_t is 64-bit. --- CHANGELOG.md | 1 + src/plugins/irc/irc-protocol.c | 15 +++++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 985f9c3f2..081d1b8de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ SPDX-License-Identifier: GPL-3.0-or-later - guile, lua, perl, python, ruby, tcl: fix conversion of dates in the API functions - irc: limit size of data received from the server to prevent memory exhaustion - irc: fix out-of-bounds read on incoming DCC command with a quoted filename ending the message ([#2322](https://github.com/weechat/weechat/issues/2322)) +- irc: fix conversion of dates in received messages - relay: limit size of decompressed websocket frame with permessage-deflate to prevent memory exhaustion ([GHSA-v2v4-45wm-5cr3](https://github.com/weechat/weechat/security/advisories/GHSA-v2v4-45wm-5cr3), [CVE-2026-53524](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2026-53524)) - relay: limit size of received websocket frame and HTTP body to prevent memory exhaustion - relay: limit size of partial message received while reading an HTTP request to prevent memory exhaustion diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index c957b3189..48a2fd096 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -4710,7 +4710,7 @@ IRC_PROTOCOL_CALLBACK(317) min = ((idle_time % (60 * 60 * 24)) % (60 * 60)) / 60; sec = ((idle_time % (60 * 60 * 24)) % (60 * 60)) % 60; - datetime = (time_t)(atol (ctxt->params[3])); + datetime = (time_t)(atoll (ctxt->params[3])); ptr_buffer = irc_msgbuffer_get_target_buffer (ctxt->server, ctxt->params[1], ctxt->command, "whois", NULL); @@ -5066,7 +5066,7 @@ IRC_PROTOCOL_CALLBACK(329) ptr_channel = irc_channel_search (ctxt->server, ctxt->params[1]); - datetime = (time_t)(atol (ctxt->params[2])); + datetime = (time_t)(atoll (ctxt->params[2])); if (ptr_channel) { @@ -5290,8 +5290,7 @@ IRC_PROTOCOL_CALLBACK(333) ptr_channel = irc_channel_search (ctxt->server, ctxt->params[1]); ptr_nick = (ptr_channel) ? irc_nick_search (ctxt->server, ptr_channel, topic_nick) : NULL; - datetime = (ctxt->num_params > 3) ? - (time_t)(atol (ctxt->params[3])) : (time_t)(atol (ctxt->params[2])); + datetime = (time_t)(atoll ((ctxt->num_params > 3) ? ctxt->params[3] : ctxt->params[2])); if (!topic_nick && (datetime == 0)) return WEECHAT_RC_OK; @@ -5598,7 +5597,7 @@ IRC_PROTOCOL_CALLBACK(346) irc_message_get_address_from_host (ctxt->params[3])); if (ctxt->num_params >= 5) { - datetime = (time_t)(atol (ctxt->params[4])); + datetime = (time_t)(atoll (ctxt->params[4])); if (ptr_modelist) irc_modelist_item_new (ptr_modelist, ctxt->params[2], ctxt->params[3], datetime); weechat_printf_datetime_tags ( @@ -5777,7 +5776,7 @@ IRC_PROTOCOL_CALLBACK(348) irc_message_get_address_from_host (ctxt->params[3])); if (ctxt->num_params >= 5) { - datetime = (time_t)(atol (ctxt->params[4])); + datetime = (time_t)(atoll (ctxt->params[4])); if (ptr_modelist) irc_modelist_item_new (ptr_modelist, ctxt->params[2], ctxt->params[3], datetime); weechat_printf_datetime_tags ( @@ -6807,7 +6806,7 @@ IRC_PROTOCOL_CALLBACK(367) irc_message_get_address_from_host (ctxt->params[3])); if (ctxt->num_params >= 5) { - datetime = (time_t)(atol (ctxt->params[4])); + datetime = (time_t)(atoll (ctxt->params[4])); if (ptr_modelist) { irc_modelist_item_new (ptr_modelist, ctxt->params[2], ctxt->params[3], @@ -7382,7 +7381,7 @@ IRC_PROTOCOL_CALLBACK(728) irc_message_get_address_from_host (ctxt->params[4])); if (ctxt->num_params >= 6) { - datetime = (time_t)(atol (ctxt->params[5])); + datetime = (time_t)(atoll (ctxt->params[5])); if (ptr_modelist) { irc_modelist_item_new (ptr_modelist, ctxt->params[3], ctxt->params[4],