Patch from David Updegraff to avoid corrupting memory while parsing the
authorEric Andersen <andersen@codepoet.org>
Sat, 19 Apr 2003 23:15:06 +0000 (23:15 -0000)
committerEric Andersen <andersen@codepoet.org>
Sat, 19 Apr 2003 23:15:06 +0000 (23:15 -0000)
networks/iterfaces file with next_word routine.  Without this, next_word
increments one beyond the end of the string.

networking/ifupdown.c

index fedae8dd6a282419a2b83d33657226283a6b7547..6c79c200426198e5341f0f720134f61e7a52999a 100644 (file)
@@ -630,8 +630,11 @@ static char *next_word(char **buf)
                return(NULL);
        }
        *buf = word + length;
-       **buf = '\0';
-       (*buf)++;
+       /*DBU:[dave@cray.com] if we are already at EOL dont't increment beyond it */
+       if (**buf) {
+               **buf = '\0';
+               (*buf)++;
+       }
 
        return word;
 }