summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-07-16 12:33:16 (GMT)
committer Denys Vlasenko <vda.linux@googlemail.com>2009-07-16 12:33:16 (GMT)
commit9531f7dad708b9130142aaaac6ed095f23ed3c35 (patch)
tree6b019db3eda8215a8e9605361ebc7c96ca0a9a59
parent5c2e81bb67750fa36e7901182e979cfdf8f5cc41 (diff)
downloadbusybox-9531f7dad708b9130142aaaac6ed095f23ed3c35.tar.gz
busybox-9531f7dad708b9130142aaaac6ed095f23ed3c35.tar.bz2
another small lineedit fix
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--libbb/lineedit.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index a3d9395..9a773b4 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 */