mirror of
https://github.com/neovim/neovim.git
synced 2025-10-09 03:16:31 +00:00
coverity/161216: get_user_input: RETURN_LOCAL
*** CID 161216: Memory - illegal accesses (RETURN_LOCAL) /src/nvim/eval.c: 11143 in get_user_input() 11137 rettv->vval.v_string = 11138 (char_u *)getcmdline_prompt(inputsecret_flag ? NUL : '@', p, echo_attr, 11139 xp_type, xp_arg, input_callback); 11140 ex_normal_busy = save_ex_normal_busy; 11141 callback_free(&input_callback); 11142 >>> CID 161216: Memory - illegal accesses (RETURN_LOCAL) >>> Using "cancelreturn", which points to an out-of-scope variable "def". 11143 if (rettv->vval.v_string == NULL && cancelreturn != NULL) { 11144 rettv->vval.v_string = (char_u *)xstrdup(cancelreturn); 11145 } 11146 11147 xfree(xp_arg); 11148
This commit is contained in:
@@ -11110,6 +11110,7 @@ void get_user_input(const typval_T *const argvars,
|
||||
char defstr_buf[NUMBUFLEN];
|
||||
char cancelreturn_buf[NUMBUFLEN];
|
||||
char xp_name_buf[NUMBUFLEN];
|
||||
char def[1] = { 0 };
|
||||
if (argvars[0].v_type == VAR_DICT) {
|
||||
if (argvars[1].v_type != VAR_UNKNOWN) {
|
||||
emsgf(_("E5050: {opts} must be the only argument"));
|
||||
@@ -11124,7 +11125,6 @@ void get_user_input(const typval_T *const argvars,
|
||||
if (defstr == NULL) {
|
||||
return;
|
||||
}
|
||||
char def[1] = { 0 };
|
||||
cancelreturn = tv_dict_get_string_buf_chk(dict, S_LEN("cancelreturn"),
|
||||
cancelreturn_buf, def);
|
||||
if (cancelreturn == NULL) { // error
|
||||
|
Reference in New Issue
Block a user