Diff between 2765dd328cbf492c6453e80534cb1c4abee383e6 and 067c2e793e41765300006648b1fa546b42913805

Changed Files

File Additions Deletions Status
client/main.c +4 -2 modified

Full Patch

diff --git a/client/main.c b/client/main.c
index 2cb449f..0095aa0 100644
--- a/client/main.c
+++ b/client/main.c
@@ -2601,10 +2601,11 @@ static char **cmd_completion(const char *text, int start, int end)
 
 	if (start > 0) {
 		int i;
+		char *input_cmd;
 
+		input_cmd = g_strndup(rl_line_buffer, start -1);
 		for (i = 0; cmd_table[i].cmd; i++) {
-			if (strncmp(cmd_table[i].cmd,
-					rl_line_buffer, start - 1))
+			if (strcmp(cmd_table[i].cmd, input_cmd))
 				continue;
 
 			if (!cmd_table[i].gen)
@@ -2614,6 +2615,7 @@ static char **cmd_completion(const char *text, int start, int end)
 			matches = rl_completion_matches(text, cmd_table[i].gen);
 			break;
 		}
+		g_free(input_cmd);
 	} else {
 		rl_completion_display_matches_hook = NULL;
 		matches = rl_completion_matches(text, cmd_generator);