From 9531f7dad708b9130142aaaac6ed095f23ed3c35 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 16 Jul 2009 14:33:16 +0200 Subject: another small lineedit fix Signed-off-by: Denys Vlasenko --- libbb/lineedit.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libbb') diff --git a/libbb/lineedit.c b/libbb/lineedit.c index a3d939551..9a773b4b8 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c @@ -429,7 +429,9 @@ static void input_delete(int save) #endif memmove(command_ps + j, command_ps + j + 1, - (command_len - j + 1) * sizeof(command_ps[0])); + /* (command_len + 1 [because of NUL]) - (j + 1) + * simplified into (command_len - j) */ + (command_len - j) * sizeof(command_ps[0])); command_len--; input_end(); /* rewrite new line */ cmdedit_set_out_char(' '); /* erase char */ -- cgit v1.2.3