diff lib/config_file.c @ 107:982e3890e7fe

2003-2-17 Brian Masney <masneyb@gftp.org> * lib/protocols.c lib/rfc959.c - added VMS directory listing support * lib/config_file.c lib/protocols.c - extra checks when stripping off carriage returns and linefeeds
author masneyb
date Mon, 17 Feb 2003 22:42:16 +0000
parents 5f9ad9facf0e
children 76e2b58a9440
line wrap: on
line diff
--- a/lib/config_file.c	Mon Feb 10 19:56:37 2003 +0000
+++ b/lib/config_file.c	Mon Feb 17 22:42:16 2003 +0000
@@ -280,9 +280,9 @@
   while (fgets (buf, sizeof (buf), conffile))
     {
       len = strlen (buf);
-      if (buf[len - 1] == '\n')
+      if (len > 0 && buf[len - 1] == '\n')
 	buf[--len] = '\0';
-      if (len && buf[len - 1] == '\r')
+      if (len > 0 && buf[len - 1] == '\r')
 	buf[--len] = '\0';
       line++;
 
@@ -562,9 +562,9 @@
   while (fgets (buf, sizeof (buf), bmfile))
     {
      len = strlen (buf);
-      if (buf[len - 1] == '\n')
+      if (len > 0 && buf[len - 1] == '\n')
 	buf[--len] = '\0';
-      if (len && buf[len - 1] == '\r')
+      if (len > 0 && buf[len - 1] == '\r')
 	buf[--len] = '\0';
       line++;