1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-25 04:16:38 +02:00

core: fix integer overflow when setting integer option with ++N or --N

This commit is contained in:
Sébastien Helleu
2023-08-17 17:03:34 +02:00
parent 77911680bb
commit 4eabcdf840
2 changed files with 7 additions and 6 deletions
+1
View File
@@ -15,6 +15,7 @@ For a list of important changes that require manual actions, please look at rele
Bug fixes::
* core: fix integer overflow when setting integer option with `++N` or `--N`
* irc: add missing tags on multiline messages (issue #1987)
* irc: fix redirection of command `/list` when the reply doesn't start with message 321 (start of /list)
+6 -6
View File
@@ -1527,22 +1527,22 @@ config_file_option_set (struct t_config_option *option, const char *value,
{
error = NULL;
number = strtol (value + 2, &error, 10);
if (error && !error[0])
if (error && !error[0]
&& (long)old_value + number <= (long)(option->max))
{
value_int = old_value + number;
if (value_int <= option->max)
new_value_ok = 1;
new_value_ok = 1;
}
}
else if (strncmp (value, "--", 2) == 0)
{
error = NULL;
number = strtol (value + 2, &error, 10);
if (error && !error[0])
if (error && !error[0]
&& (long)old_value - number >= (long)(option->min))
{
value_int = old_value - number;
if (value_int >= option->min)
new_value_ok = 1;
new_value_ok = 1;
}
}
else