View Issue Details

IDProjectCategoryView StatusLast Update
0001447libmicrohttpdHTTP POSTpublic2009-02-08 22:20
ReporterSimon Newton Assigned ToChristian Grothoff  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product VersionGit master 
Summary0001447: Size argument in MHD_PostDataIterator doesn't account for unescaped data
DescriptionThe size argument passed to a MHD_PostDataIterator doesn't account for escaped characters in the form data. The bug is here:

   xbuf[xoff] = '\0'; /* 0-terminate in preparation *
   MHD_http_unescape (xbuf);
   // ^ this changes the size of the buffer

   /* finally: call application! */
TagsNo tags attached.
Attached Files
invalid_size.diff (992 bytes)   
Index: postprocessor_test.c
===================================================================
--- postprocessor_test.c	(revision 8149)
+++ postprocessor_test.c	(working copy)
@@ -41,9 +41,9 @@
  * five NULL-entries.
  */
 const char *want[] = {
-#define URL_DATA "abc=def&x=5"
+#define URL_DATA "abc=def%2C&x=5"
 #define URL_START 0
-  "abc", NULL, NULL, NULL, "def",
+  "abc", NULL, NULL, NULL, "def,",
   "x", NULL, NULL, NULL, "5",
 #define URL_END (URL_START + 10)
   NULL, NULL, NULL, NULL, NULL,
Index: postprocessor.c
===================================================================
--- postprocessor.c	(revision 8149)
+++ postprocessor.c	(working copy)
@@ -404,6 +404,7 @@
           /* unescape */
           xbuf[xoff] = '\0';    /* 0-terminate in preparation */
           MHD_http_unescape (xbuf);
+          xoff = strlen(xbuf);
 
           /* finally: call application! */
           if (MHD_NO == pp->ikvi (pp->cls, MHD_POSTDATA_KIND, (const char *) &pp[1],    /* key */
invalid_size.diff (992 bytes)   

Activities

Issue History

Date Modified Username Field Change
2009-02-02 11:01 Simon Newton New Issue
2009-02-02 11:01 Simon Newton File Added: invalid_size.diff
2009-02-02 22:22 Christian Grothoff Status new => resolved
2009-02-02 22:22 Christian Grothoff Resolution open => fixed
2009-02-02 22:22 Christian Grothoff Assigned To => Christian Grothoff
2009-02-08 22:20 Christian Grothoff Status resolved => closed