diff options
author | Frederic Cambus <fcambus@cvs.openbsd.org> | 2017-06-02 20:02:40 +0000 |
---|---|---|
committer | Frederic Cambus <fcambus@cvs.openbsd.org> | 2017-06-02 20:02:40 +0000 |
commit | 57aff61bf45ea731661d5bbd929a6dd7a9f353b7 (patch) | |
tree | 551299c899897430aeda42abed7e134bb37506b8 /games/fortune | |
parent | dc92c29704ba7246914ceb5d6a0a11588000ed8b (diff) |
Fix an infinite loop in fortune(6).
When invoking fortune with the -l option (to get long dictums only),
the program gets stuck in an infinite loop because fortlen() doesn't
return the fortune length correctly.
OK mestre@, tb@, deraadt@, schwarze@
Diffstat (limited to 'games/fortune')
-rw-r--r-- | games/fortune/fortune/fortune.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/games/fortune/fortune/fortune.c b/games/fortune/fortune/fortune.c index 4d9cd4242e8..41b5b179ebd 100644 --- a/games/fortune/fortune/fortune.c +++ b/games/fortune/fortune/fortune.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fortune.c,v 1.55 2016/03/07 22:49:45 tb Exp $ */ +/* $OpenBSD: fortune.c,v 1.56 2017/06/02 20:02:39 fcambus Exp $ */ /* $NetBSD: fortune.c,v 1.8 1995/03/23 08:28:40 cgd Exp $ */ /*- @@ -218,7 +218,7 @@ fortlen(void) char line[BUFSIZ]; if (!(Fortfile->tbl.str_flags & (STR_RANDOM | STR_ORDERED))) - nchar = (Seekpts[1] - Seekpts[0] <= SLEN); + nchar = Seekpts[1] - Seekpts[0]; else { open_fp(Fortfile); (void) fseek(Fortfile->inf, (long)Seekpts[0], SEEK_SET); |