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 <shigio@wafu.netgate.net>
This commit is contained in:
Poul-Henning Kamp 1998-04-19 18:00:49 +00:00
parent 0a61a2c2ce
commit d459926593
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=35307

View file

@ -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