diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2000-07-25 17:08:13 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2000-07-25 17:08:13 +0000 |
commit | 8d6ac6c70bdb969f7ce68a157bd9d6a3ca75ac7b (patch) | |
tree | 617070dbef455a999918635958834bf2191fc7e8 | |
parent | 63c85e4e95ee2ea3affea81c802da23c5f3f0b20 (diff) |
Fix indent endless on garbage input.
Found by deraadt@
-rw-r--r-- | usr.bin/indent/indent.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/indent/indent.c b/usr.bin/indent/indent.c index 50a75cbf32f..293f8b17be5 100644 --- a/usr.bin/indent/indent.c +++ b/usr.bin/indent/indent.c @@ -1,4 +1,4 @@ -/* $OpenBSD: indent.c,v 1.7 2000/06/30 16:00:15 millert Exp $ */ +/* $OpenBSD: indent.c,v 1.8 2000/07/25 17:08:12 espie Exp $ */ /* * Copyright (c) 1985 Sun Microsystems, Inc. @@ -45,7 +45,7 @@ char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)indent.c 5.16 (Berkeley) 2/26/91";*/ -static char rcsid[] = "$OpenBSD: indent.c,v 1.7 2000/06/30 16:00:15 millert Exp $"; +static char rcsid[] = "$OpenBSD: indent.c,v 1.8 2000/07/25 17:08:12 espie Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -996,7 +996,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) |