Fix neovim tag bugs uncovered by vim-8.2.0088,

but not related to the patch.  Specifically:

    - settagstack()'s e_listreq is in the wrong place
    - in :ltag, vim_strncpy -> xstrlcpy length parameter is different
        xstrlcpy's length includes the null terminator (so add one)
    - in :ltag, STRNCAT -> xstrlcat takes dest size, not number to copy
        use snprintf instead
This commit is contained in:
Andy K. Massimino 2021-03-21 12:06:23 -04:00
parent 6519b18471
commit e25ebf6b4f
2 changed files with 4 additions and 4 deletions

View File

@ -8809,8 +8809,6 @@ static void f_settagstack(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (set_tagstack(wp, d, action) == OK) {
rettv->vval.v_number = 0;
} else {
EMSG(_(e_listreq));
}
}

View File

@ -908,7 +908,7 @@ add_llist_tags(
if (len > 128) {
len = 128;
}
xstrlcpy((char *)tag_name, (const char *)tagp.tagname, len);
xstrlcpy((char *)tag_name, (const char *)tagp.tagname, len + 1);
tag_name[len] = NUL;
// Save the tag file name
@ -975,7 +975,8 @@ add_llist_tags(
if (cmd_len > (CMDBUFFSIZE - 5)) {
cmd_len = CMDBUFFSIZE - 5;
}
xstrlcat((char *)cmd, (char *)cmd_start, cmd_len);
snprintf((char *)cmd + len, CMDBUFFSIZE + 1 - len,
"%.*s", cmd_len, cmd_start);
len += cmd_len;
if (cmd[len - 1] == '$') {
@ -3406,6 +3407,7 @@ int set_tagstack(win_T *wp, const dict_T *d, int action)
if ((di = tv_dict_find(d, "items", -1)) != NULL) {
if (di->di_tv.v_type != VAR_LIST) {
EMSG(_(e_listreq));
return FAIL;
}
l = di->di_tv.vval.v_list;