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

patch 9.0.1444: crash when passing NULL to setcmdline()

Problem:    Crash when passing NULL to setcmdline(). (Andreas Louv)
Solution:   Use tv_get_string() instead of using v_string directly.
            (closes #12231, closes #12227)
This commit is contained in:
zeertzjq
2023-04-12 16:21:14 +01:00
committed by Bram Moolenaar
parent 05a627c3d4
commit ac6cd31afc
3 changed files with 12 additions and 1 deletions

View File

@@ -4294,7 +4294,8 @@ f_setcmdline(typval_T *argvars, typval_T *rettv)
}
}
rettv->vval.v_number = set_cmdline_str(argvars[0].vval.v_string, pos);
// Use tv_get_string() to handle a NULL string like an empty string.
rettv->vval.v_number = set_cmdline_str(tv_get_string(&argvars[0]), pos);
}
/*