From 7d15651115d9590e89eb35dec8d090f083e352c6 Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Tue, 27 Jan 2004 12:39:34 +0000
Subject: [PATCH] don't advance the line pointer if it already points to the
 null terminator

---
 src/main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/main.c b/src/main.c
index dc7d0f6556..6bd153147e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2039,7 +2039,7 @@ static int parseconfig(const char *filename,
       alloced_param=FALSE;
 
       /* lines with # in the fist column is a comment! */
-      while(isspace((int)*line))
+      while(*line && isspace((int)*line))
         line++;
 
       switch(*line) {
@@ -2059,7 +2059,8 @@ static int parseconfig(const char *filename,
         line++;
       /* ... and has ended here */
 
-      *line++=0; /* zero terminate, we have a local copy of the data */
+      if(*line)
+        *line++=0; /* zero terminate, we have a local copy of the data */
 
 #ifdef DEBUG_CONFIG
       fprintf(stderr, "GOT: %s\n", option);
-- 
GitLab