summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/cmd_log.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/common/cmd_log.c b/common/cmd_log.c
index f9fbe00..9a3fdc3 100644
--- a/common/cmd_log.c
+++ b/common/cmd_log.c
@@ -219,7 +219,9 @@ int do_log (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
start = log->v1.start;
size = log->v1.size;
}
- for (i=0; i < (size&LOGBUFF_MASK); i++) {
+ if (size > LOGBUFF_LEN)
+ size = LOGBUFF_LEN;
+ for (i = 0; i < size; i++) {
s = lbuf+((start+i)&LOGBUFF_MASK);
putc (*s);
}