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:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user