From 55d403c9b225e4bdb18037983de062d66017d684 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Sun, 18 Dec 2016 05:14:55 +0000 Subject: [PATCH] lib: fix crash when tab-completing `do ...` commands Signed-off-by: Quentin Young --- lib/command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/command.c b/lib/command.c index a93f3a55e802..ca0d0c001bad 100644 --- a/lib/command.c +++ b/lib/command.c @@ -667,7 +667,7 @@ cmd_complete_command (vector vline, struct vty *vty, int *status) // construct the input line we'll be matching on unsigned int offset = (do_shortcut) ? 1 : 0; for (unsigned index = 0; index + offset < vector_active (vline); index++) - vector_set_index (input_line, index + offset, vector_lookup (vline, index)); + vector_set_index (input_line, index, vector_lookup (vline, index + offset)); // get token completions -- this is a copying operation vector comps = NULL, initial_comps;