diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2023-11-01 09:09:00 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2023-11-01 09:44:44 +0100 |
commit | f53983bc790b8201431ee18fd5411311df6fabd6 (patch) | |
tree | 554d5548290934f0514e7742858b6aa9362b027d /src/core/wee-command.c | |
parent | 1dd535da5dc04852de48555fe222eb17881c48c2 (diff) | |
download | weechat-f53983bc790b8201431ee18fd5411311df6fabd6.zip |
core: display an error with command `/history N` when N is not a valid integer
Diffstat (limited to 'src/core/wee-command.c')
-rw-r--r-- | src/core/wee-command.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/core/wee-command.c b/src/core/wee-command.c index 00631cc6a..f0361db58 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -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) |