diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2006-08-23 11:49:50 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2006-08-23 11:49:50 +0000 |
commit | 762cc8231bb3e352f74c9c75d563dc0295cdd3b6 (patch) | |
tree | 3ae96211fd221a65b207447be53f122fb37d20ed /usr.bin/rcs | |
parent | 1418263de2f6607466d3024c6710d617600665f8 (diff) |
Add missing checks for EOF when parsing rcs file sections.
OK xsa@ joris@ niallo@
Diffstat (limited to 'usr.bin/rcs')
-rw-r--r-- | usr.bin/rcs/rcs.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/usr.bin/rcs/rcs.c b/usr.bin/rcs/rcs.c index c968e777b10..1c65239632a 100644 --- a/usr.bin/rcs/rcs.c +++ b/usr.bin/rcs/rcs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.c,v 1.31 2006/08/07 20:55:28 ray Exp $ */ +/* $OpenBSD: rcs.c,v 1.32 2006/08/23 11:49:49 millert Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -2408,7 +2408,10 @@ rcs_gettok(RCSFILE *rfp) *(bp++) = ch; for (;;) { ch = getc(pdp->rp_file); - if (!isalnum(ch) && ch != '_' && ch != '-' && + if (ch == EOF) { + type = RCS_TOK_EOF; + break; + } else if (!isalnum(ch) && ch != '_' && ch != '-' && ch != '/') { ungetc(ch, pdp->rp_file); break; @@ -2437,7 +2440,10 @@ rcs_gettok(RCSFILE *rfp) type = RCS_TOK_STRING; for (;;) { ch = getc(pdp->rp_file); - if (ch == '@') { + if (ch == EOF) { + type = RCS_TOK_EOF; + break; + } else if (ch == '@') { ch = getc(pdp->rp_file); if (ch != '@') { ungetc(ch, pdp->rp_file); @@ -2463,6 +2469,10 @@ rcs_gettok(RCSFILE *rfp) for (;;) { ch = getc(pdp->rp_file); + if (ch == EOF) { + type = RCS_TOK_EOF; + break; + } if (bp == pdp->rp_bufend) break; if (!isdigit(ch) && ch != '.') { |