From 9092f754bd4afc5f0928ee3041abb950f749b9e1 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Thu, 26 Jun 2008 22:40:02 +0000 Subject: [PATCH] print_flags: fix trivial thinko vi: fix reversed checks for underflow --- editors/vi.c | 4 ++-- libbb/print_flags.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/editors/vi.c b/editors/vi.c index 1b335d9a1..7603c9764 100644 --- a/editors/vi.c +++ b/editors/vi.c @@ -1659,12 +1659,12 @@ static char *char_insert(char *p, char c) // insert the char c at 'p' cmdcnt = 0; end_cmd_q(); // stop adding to q last_status_cksum = 0; // force status update - if ((p[-1] != '\n') && (dot > text)) { + if ((p > text) && (p[-1] != '\n')) { p--; } } else if (c == erase_char || c == 8 || c == 127) { // Is this a BS // 123456789 - if ((p[-1] != '\n') && (dot>text)) { + if ((p > text) && (p[-1] != '\n')) { p--; p = text_hole_delete(p, p); // shrink buffer 1 char } diff --git a/libbb/print_flags.c b/libbb/print_flags.c index 413f51653..a1dcc01ec 100644 --- a/libbb/print_flags.c +++ b/libbb/print_flags.c @@ -19,8 +19,8 @@ int print_flags_separated(const int *masks, const char *labels, int flags, const labels); need_separator = separator; flags &= ~ *masks; - masks++; } + masks++; labels += strlen(labels) + 1; } return flags; -- 2.25.1