1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-04 00:33:13 +02:00

core: fix buffer overflow in function util_parse_time

This commit is contained in:
Sébastien Helleu
2025-05-08 19:09:18 +02:00
parent 2bc290b6ed
commit 1d808a1f1c
2 changed files with 5 additions and 3 deletions
+1
View File
@@ -27,6 +27,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
- core: consider all keys are safe in cursor context ([#2244](https://github.com/weechat/weechat/issues/2244))
- core: fix integer overflow with decimal numbers in calculation of expression
- core: fix integer overflow in base32 encoding/decoding
- core: fix buffer overflow in function util_parse_time
- core: fix memory leak in function util_parse_delay
- irc: display nick changes and quit messages when option irc.look.ignore_tag_messages is enabled ([#2241](https://github.com/weechat/weechat/issues/2241))
- perl: fix build when multiplicity is not available ([#2243](https://github.com/weechat/weechat/issues/2243))
+4 -3
View File
@@ -287,7 +287,8 @@ util_strftimeval (char *string, int max, const char *format, struct timeval *tv)
int
util_parse_time (const char *datetime, struct timeval *tv)
{
char *string, *pos, *pos2, str_usec[16], *error, str_date[128];
char *string, *pos, *pos2, str_usec[16], *error;
char str_date[128], str_date2[256];
struct tm tm_date, tm_date_gm, tm_date_local, *local_time;
time_t time_now, time_gm, time_local;
long long value;
@@ -447,10 +448,10 @@ util_parse_time (const char *datetime, struct timeval *tv)
local_time = localtime (&time_now);
strftime (str_date, sizeof (str_date),
"%Y-%m-%dT", local_time);
strcat (str_date, string);
snprintf (str_date2, sizeof (str_date2), "%s%s", str_date, string);
/* initialize structure, because strptime does not do it */
memset (&tm_date, 0, sizeof (struct tm));
pos = strptime (str_date, "%Y-%m-%dT%H:%M:%S", &tm_date);
pos = strptime (str_date2, "%Y-%m-%dT%H:%M:%S", &tm_date);
if (pos)
{
if (use_local_time)