Package: cgilib
Version: 0.5-4
Severity: important
Tags: patch


-- System Information
Debian Release: 3.0
Architecture: i386
Kernel: Linux earth.cosmos.com 2.4.20 #1 Mon Dec 20 16:31:57 CET 2004 i686
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED]


Hello,


While testing a S-Lang module for cgilib
(http://www.cheesit.com/downloads/slang/slcgi), I've found that sometimes
the empty line that should separate the HTTP header from the body is not
empty. This is caused by rubbish being printed after the newline of the last
header, and this seems to be caused by cgiSetHeader not always
null-terminating the cgiHeaderString. This patch should fix it:

--- cgi.c~      Fri Aug 20 23:14:07 1999
+++ cgi.c       Sat Jan 22 23:51:55 2005
@@ -64,6 +64,7 @@
        pivot[cp-name+2] = '\0';
        strncat (pivot, value, vp-value);
        pivot[cp-name+2+vp-value] = '\n';
+        pivot[cp-name+3+vp-value] = '\0';
     } else {
        len = (cp-name + vp-value + 4) * sizeof (char);
        if ((cgiHeaderString = (char *)malloc (len)) == NULL)
@@ -74,6 +75,7 @@
        cgiHeaderString[cp-name+2] = '\0';
        strncat (cgiHeaderString, value, vp-value);
        cgiHeaderString[cp-name+2+vp-value] = '\n';
+               cgiHeaderString[cp-name+3+vp-value] = '\0';
     }
     return 1;
 }


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to