Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-07-23 15:21:07 +0300
committerDenys Vlasenko <vda.linux@googlemail.com>2018-07-30 19:02:27 +0300
commitabe8fc3663152dd5050c7025f897a758f32d0212 (patch)
tree8319d6434be2f2cfe8fc1846fefeac19721a2ae0
parent981c0b109dce7972e30074847880a6f91d2dfda9 (diff)
hexedit: fixes for redraw and down movement causing SEGV on attempt to access
"Go to:" command was not updating row position, making next "down" movements for one screenful print empty lines instead of showing the contents. If the file is whole pages long, "down" movement at EOF was advancing position +16 bytes, mapping the next portion (entirely past the end of the file), then finding out that the new position is beyond the EOF, rolling it back -16 bytes... ending up with this postion pointing *before* the mapped portion. Any next access (e.g. "move right" key) SEGVs. function old new delta hexedit_main 1170 1184 +14 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--miscutils/hexedit.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/miscutils/hexedit.c b/miscutils/hexedit.c
index 95c930d12..298eb8149 100644
--- a/miscutils/hexedit.c
+++ b/miscutils/hexedit.c
@@ -153,7 +153,8 @@ static void redraw(unsigned cursor)
i++;
}
- printf(ESC"[%u;%uH", 1 + cursor / 16, 1 + pos + (cursor & 0xf) * 3);
+ G.row = cursor / 16;
+ printf(ESC"[%u;%uH", 1 + G.row, 1 + pos + (cursor & 0xf) * 3);
}
static void redraw_cur_line(void)
@@ -367,6 +368,8 @@ int hexedit_main(int argc UNUSED_PARAM, char **argv)
if (G.current_byte > G.eof_byte) {
/* _after_ eof - don't allow this */
G.current_byte -= 16;
+ if (G.current_byte < G.baseaddr)
+ move_mapping_lower();
break;
}
}