From fbca3bbacbe6e223a5e15d8265301b7d2c36af4e Mon Sep 17 00:00:00 2001 From: Brian Ashworth Date: Thu, 31 May 2018 09:07:35 -0400 Subject: [PATCH] Fix condition in peek_line --- common/readline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/readline.c b/common/readline.c index f637b64d4..4f55e99c9 100644 --- a/common/readline.c +++ b/common/readline.c @@ -58,7 +58,7 @@ char *peek_line(FILE *file, int offset, long *position) { if (read < 0) { break; } - if (line[read - 1] == '\n') { + if (read > 0 && line[read - 1] == '\n') { line[read - 1] = '\0'; } }