mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-04-29 06:10:37 +00:00
Merge pull request #13637 from yyuanam/fix_vtysh_core
lib: fix vtysh core when handling questionmark
This commit is contained in:
commit
89eaf9b7a0
@ -735,9 +735,13 @@ char *cmd_variable_comp2str(vector comps, unsigned short cols)
|
|||||||
char *item = vector_slot(comps, j);
|
char *item = vector_slot(comps, j);
|
||||||
itemlen = strlen(item);
|
itemlen = strlen(item);
|
||||||
|
|
||||||
if (cs + itemlen + AUTOCOMP_INDENT + 3 >= bsz)
|
size_t next_sz = cs + itemlen + AUTOCOMP_INDENT + 3;
|
||||||
buf = XREALLOC(MTYPE_TMP, buf, (bsz *= 2));
|
|
||||||
|
|
||||||
|
if (next_sz > bsz) {
|
||||||
|
/* Make sure the buf size is large enough */
|
||||||
|
bsz = next_sz;
|
||||||
|
buf = XREALLOC(MTYPE_TMP, buf, bsz);
|
||||||
|
}
|
||||||
if (lc + itemlen + 1 >= cols) {
|
if (lc + itemlen + 1 >= cols) {
|
||||||
cs += snprintf(&buf[cs], bsz - cs, "\n%*s",
|
cs += snprintf(&buf[cs], bsz - cs, "\n%*s",
|
||||||
AUTOCOMP_INDENT, "");
|
AUTOCOMP_INDENT, "");
|
||||||
|
Loading…
Reference in New Issue
Block a user