Terminate a freshly allocated string as well.
[infodrom/cgilib] / 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;
+       *pivot = '\0';
     }
     memset(pivot+1, 0, (cp-name + vp-value + 4));