From 30bb5dedcae628416907fb42c9133a4368ce649d Mon Sep 17 00:00:00 2001 From: obrien Date: Tue, 27 Feb 2001 20:50:34 +0000 Subject: Fix indent endless on garbage input (i.e., if it encountered EOF while waiting for a '}' nesting terminator) Obtained from: OpenBSD rev 1.8 --- usr.bin/indent/indent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'usr.bin/indent/indent.c') diff --git a/usr.bin/indent/indent.c b/usr.bin/indent/indent.c index c790720..447c8e2 100644 --- a/usr.bin/indent/indent.c +++ b/usr.bin/indent/indent.c @@ -997,7 +997,7 @@ check_type: if (buf_ptr >= buf_end) fill_buffer(); } - while (*buf_ptr != '\n' || in_comment) { + while (*buf_ptr != '\n' || (in_comment && !had_eof)) { CHECK_SIZE_LAB; *e_lab = *buf_ptr++; if (buf_ptr >= buf_end) -- cgit v1.1