Terminate a freshly allocated string as well.
authorJoey Schulze <joey@infodrom.org>
Wed, 1 Jul 2009 16:05:14 +0000 (16:05 +0000)
committerJoey Schulze <joey@infodrom.org>
Wed, 1 Jul 2009 16:05:14 +0000 (16:05 +0000)
cgi.c

diff --git a/cgi.c b/cgi.c
index 6bfb492..e390b37 100644 (file)
--- a/cgi.c
+++ b/cgi.c
@@ -64,6 +64,7 @@ int cgiSetHeader (const char *name, const char *value)
        if ((cgiHeaderString = (char *)malloc (len)) == NULL)
            return 0;
        pivot = cgiHeaderString;
        if ((cgiHeaderString = (char *)malloc (len)) == NULL)
            return 0;
        pivot = cgiHeaderString;
+       *pivot = '\0';
     }
     memset(pivot+1, 0, (cp-name + vp-value + 4));
 
     }
     memset(pivot+1, 0, (cp-name + vp-value + 4));