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

core: display an error with command /history N when N is not a valid integer

This commit is contained in:
Sébastien Helleu
2023-11-01 09:09:00 +01:00
parent 1dd535da5d
commit f53983bc79
2 changed files with 8 additions and 1 deletions
+1
View File
@@ -24,6 +24,7 @@ New features::
Bug fixes::
* core: display an error with command `/history N` when N is not a valid integer
* core: fix memory leak when config version is invalid or not supported
* core: fix crash when "config_version" is present in a configuration file without a value
* core: display an error on startup if environment variable "HOME" is not set
+7 -1
View File
@@ -3386,6 +3386,7 @@ COMMAND_CALLBACK(history)
{
struct t_gui_history *ptr_history;
int n, n_total, n_user, displayed;
char *error;
/* make C compiler happy */
(void) pointer;
@@ -3402,7 +3403,12 @@ COMMAND_CALLBACK(history)
return WEECHAT_RC_OK;
}
else
n_user = atoi (argv[1]);
{
error = NULL;
n_user = (int)strtol (argv[1], &error, 10);
if (!error || error[0] || (n_user < 0))
COMMAND_ERROR;
}
}
if (buffer->history)