0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -04:00

patch 8.2.4245: ":retab 0" may cause illegal memory access

Problem:    ":retab 0" may cause illegal memory access.
Solution:   Limit the value of 'tabstop' to 10000.
This commit is contained in:
Bram Moolenaar
2022-01-28 20:47:49 +00:00
parent 14cbf77845
commit 652dee4486
5 changed files with 17 additions and 9 deletions

View File

@@ -71,7 +71,7 @@ tabstop_set(char_u *var, int **array)
int n = atoi((char *)cp);
// Catch negative values, overflow and ridiculous big values.
if (n < 0 || n > 9999)
if (n < 0 || n > TABSTOP_MAX)
{
semsg(_(e_invalid_argument_str), cp);
vim_free(*array);
@@ -1649,7 +1649,7 @@ ex_retab(exarg_T *eap)
emsg(_(e_argument_must_be_positive));
return;
}
if (new_ts < 0 || new_ts > 9999)
if (new_ts < 0 || new_ts > TABSTOP_MAX)
{
semsg(_(e_invalid_argument_str), eap->arg);
return;