From 1daab23a66997ff68adc2127005b6c90db1f17d5 Mon Sep 17 00:00:00 2001 From: "Andrew V. Samoilov" Date: Wed, 15 Jan 2003 16:27:17 +0000 Subject: [PATCH] * man2hlp.c (main): Use fgets() return value in while loop instead of feof() because end-of-file indicator can be false on error. --- src/ChangeLog | 6 +++++- src/man2hlp.c | 7 +------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 1e327cff6..fa9c69727 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,12 +1,16 @@ 2003-01-15 Andrew V. Samoilov + * man2hlp.c (main): Use fgets() return value in while loop + instead of feof() because end-of-file indicator can be false on + error. + * man2hlp.c (handle_command): Fix possible buffer overflow. (handle_link): Likewise. 2002-12-27 Pavel Roskin * layout.c (setup_panels): Revert unnecessary part of the - previous patch. Call load_hint regardless of message_visible. + previous patch. Call load_hint() regardless of message_visible. Reported by Dmitry Semyonov * key.c (correct_key_code): Don't call get_modifier() for normal diff --git a/src/man2hlp.c b/src/man2hlp.c index e7fb5235b..e5644a255 100644 --- a/src/man2hlp.c +++ b/src/man2hlp.c @@ -684,14 +684,9 @@ main (int argc, char **argv) c_in = c_man; /* Repeat for each input line */ - while (!feof (f_man)) { + while (fgets (buffer, BUFFER_SIZE, f_man)) { char *input_line; /* Input line without initial "\&" */ - /* Read a line */ - if (!fgets (buffer, BUFFER_SIZE, f_man)) { - break; - } - if (buffer[0] == '\\' && buffer[1] == '&') input_line = buffer + 2; else