From d459926593b634265fde3cc3d107ba7d9afc4824 Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Sun, 19 Apr 1998 18:00:49 +0000 Subject: [PATCH] Ctags write to buffer beyond the end of it when the source file doesn't end with '\n'. It brings segmentation fault. PR: 4812 Reviewed by: phk Submitted by: Shigio Yamaguchi --- usr.bin/ctags/print.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/ctags/print.c b/usr.bin/ctags/print.c index b2c313a556b7..bebdeb1bc90b 100644 --- a/usr.bin/ctags/print.c +++ b/usr.bin/ctags/print.c @@ -59,7 +59,7 @@ getline() saveftell = ftell(inf); (void)fseek(inf, lineftell, L_SET); if (xflag) - for (cp = lbuf; GETC(!=, '\n'); *cp++ = c) + for (cp = lbuf; GETC(!=, EOF) && c != '\n'; *cp++ = c) continue; /* * do all processing here, so we don't step through the