[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: htp segmentation fault



On Tue, Oct 11, 2005 at 01:31:39AM -0500, Diego Escalante wrote:
> Well, the concrete problem is that it seg faults while trying to parse
> a 60Kb~ text (I guess that all-at-once). Since I don't have a s390 nor
> programming skills,

I found the problem. StreamPrintF (src/streams.c) used a va_list twice,
without reinitialize it. The attached patch fixes this problem.

Bastian

-- 
Leave bigotry in your quarters; there's no room for it on the bridge.
		-- Kirk, "Balance of Terror", stardate 1709.2
--- htp-1.15/debian/changelog
+++ htp-1.15/debian/changelog
@@ -1,3 +1,10 @@
+htp (1.15-2.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Don't use va_list more than once. 
+
+ -- Bastian Blank <waldi@debian.org>  Tue, 11 Oct 2005 07:22:00 +0000
+
 htp (1.15-2) unstable; urgency=low
 
   * Fixed memory problems in s390
--- htp-1.15.orig/src/streams.c
+++ htp-1.15/src/streams.c
@@ -278,18 +278,17 @@
     char *str = buffer;
     int len;
 
-
-    /* convert formatted arguments into single string */
     va_start(argptr, format);
-
     len = vsnprintf(str, sizeof(buffer), format, argptr);
+    va_end(argptr);
+
     if (len > sizeof(buffer) - 1) {
         str = AllocMemory(len + 1);
+        va_start(argptr, format);
         len = vsnprintf(str, len + 1, format, argptr);
+        va_end(argptr);
     }
 
-    va_end(argptr);
-
     len = PutStreamString(stream, str);
 
     if (str != buffer)

Attachment: signature.asc
Description: Digital signature


Reply to: