From 1dd423cb23839e172cf218b145c2e24cb11440af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sun, 21 Jun 2026 07:43:59 +0200 Subject: [PATCH] lua: fix conversion of dates in the API functions On modern 32-bit platforms with a 64-bit time_t, long is 32-bit but time_t is 64-bit. Use "long long" for variables cast to time_t. --- CHANGELOG.md | 2 +- src/plugins/lua/weechat-lua-api.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 416b64ac2..4bc0cfbb2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,7 +28,7 @@ SPDX-License-Identifier: GPL-3.0-or-later - api: fix infinite loop in function string_replace when the search string is empty - irc: fix tag in message with list of names when joining a channel - fset: remove error displayed in core buffer when clicking with the mouse below the last option displayed -- guile: fix conversion of dates in the API functions +- guile, lua: 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)) - 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)) diff --git a/src/plugins/lua/weechat-lua-api.c b/src/plugins/lua/weechat-lua-api.c index e7822995a..653ab9e40 100644 --- a/src/plugins/lua/weechat-lua-api.c +++ b/src/plugins/lua/weechat-lua-api.c @@ -2173,7 +2173,7 @@ API_FUNC(print) API_FUNC(print_date_tags) { const char *buffer, *tags, *message; - long date; + long long date; API_INIT_FUNC(1, "print_date_tags", API_RETURN_ERROR); if (lua_gettop (L) < 4) @@ -2197,7 +2197,7 @@ API_FUNC(print_date_tags) API_FUNC(print_datetime_tags) { const char *buffer, *tags, *message; - long date; + long long date; int date_usec; API_INIT_FUNC(1, "print_datetime_tags", API_RETURN_ERROR); @@ -2247,7 +2247,7 @@ API_FUNC(print_y_date_tags) { const char *buffer, *tags, *message; int y; - long date; + long long date; API_INIT_FUNC(1, "print_y_date_tags", API_RETURN_ERROR); if (lua_gettop (L) < 5) @@ -2274,7 +2274,7 @@ API_FUNC(print_y_datetime_tags) { const char *buffer, *tags, *message; int y, date_usec; - long date; + long long date; API_INIT_FUNC(1, "print_y_datetime_tags", API_RETURN_ERROR); if (lua_gettop (L) < 6) @@ -5008,7 +5008,7 @@ API_FUNC(infolist_new_var_time) { const char *item, *name; const char *result; - long value; + long long value; API_INIT_FUNC(1, "infolist_new_var_time", API_RETURN_EMPTY); if (lua_gettop (L) < 3)