0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.3083: crash when passing null string to charclass()

Problem:    Crash when passing null string to charclass().
Solution:   Bail out when string pointer is NULL. (Christian Brabandt,
            closes #8498, closes #8260)
This commit is contained in:
Christian Brabandt
2021-07-02 20:19:31 +02:00
committed by Bram Moolenaar
parent b836f631db
commit 72463f883c
3 changed files with 6 additions and 1 deletions

View File

@@ -5587,7 +5587,8 @@ f_setcellwidths(typval_T *argvars, typval_T *rettv UNUSED)
void
f_charclass(typval_T *argvars, typval_T *rettv UNUSED)
{
if (check_for_string_arg(argvars, 0) == FAIL)
if (check_for_string_arg(argvars, 0) == FAIL
|| argvars[0].vval.v_string == NULL)
return;
rettv->vval.v_number = mb_get_class(argvars[0].vval.v_string);
}