Hi i find out that the solution i had provided about the #172 bug (the post array not working) has a leak.
I have provided a patch witch fix it.Please review and comment.
Thank you!
>From 2a18c7e641edd5d774a818cbe29260b620703d37 Mon Sep 17 00:00:00 2001
From: Denis Mone <[email protected]>
Date: Wed, 10 Apr 2013 16:08:32 +0300
Subject: [PATCH] Follow up on bug #172. There is a problem with the sr data
 structure the sr->content_type.data field contains the
 content_type value as well as the content_length value.This
 in combination with the SHORTLEN value(64) leads wrong
 characters being copied to the content_type ENV variable.

---
 plugins/cgi/cgi.c |    5 ++++-
 plugins/cgi/cgi.h |    2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/plugins/cgi/cgi.c b/plugins/cgi/cgi.c
index 48afba9..cf4436f 100644
--- a/plugins/cgi/cgi.c
+++ b/plugins/cgi/cgi.c
@@ -170,7 +170,10 @@ static int do_cgi(const char *const __restrict__ file,
     }
 
     if (sr->content_type.len) {
-        snprintf(content_type, SHORTLEN, "CONTENT_TYPE=%s", sr->content_type.data);
+		char temp[80];
+		int l = strlen("CONTENT_TYPE=application/x-www-form-urlencoded") + 1;
+		snprintf(temp, l, "CONTENT_TYPE=%s", sr->content_type.data);
+        snprintf(content_type, SHORTLEN, temp);
         env[envpos++] = content_type;
     }
 
diff --git a/plugins/cgi/cgi.h b/plugins/cgi/cgi.h
index f9d89c7..1e41b56 100644
--- a/plugins/cgi/cgi.h
+++ b/plugins/cgi/cgi.h
@@ -35,7 +35,7 @@
 
 enum {
     PATHLEN = 1024,
-    SHORTLEN = 64;
+    SHORTLEN = 64
 };
 
 struct cgi_request {
-- 
1.7.10.4

_______________________________________________
Monkey mailing list
[email protected]
http://lists.monkey-project.com/listinfo/monkey

Reply via email to