[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] branch master updated: another issue found by test from
From: |
gnunet |
Subject: |
[libmicrohttpd] branch master updated: another issue found by test from MD |
Date: |
Sat, 11 Jul 2020 23:17:42 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository libmicrohttpd.
The following commit(s) were added to refs/heads/master by this push:
new fbec7f3f another issue found by test from MD
fbec7f3f is described below
commit fbec7f3f0833bdd07780b8d85a84ce763f63a70a
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sat Jul 11 23:11:53 2020 +0200
another issue found by test from MD
---
src/microhttpd/postprocessor.c | 1 +
src/microhttpd/test_postprocessor_md.c | 65 ++++++++++++++++++++++++++++++++++
2 files changed, 66 insertions(+)
diff --git a/src/microhttpd/postprocessor.c b/src/microhttpd/postprocessor.c
index 43ca1c4b..f5da5430 100644
--- a/src/microhttpd/postprocessor.c
+++ b/src/microhttpd/postprocessor.c
@@ -479,6 +479,7 @@ process_value (struct MHD_PostProcessor *pp,
pp->value_offset += xoff;
if (cut)
break;
+ xbuf[delta] = '%'; /* undo 0-termination */
memmove (xbuf,
&xbuf[delta],
clen);
diff --git a/src/microhttpd/test_postprocessor_md.c
b/src/microhttpd/test_postprocessor_md.c
index 930f7fb3..111cad49 100644
--- a/src/microhttpd/test_postprocessor_md.c
+++ b/src/microhttpd/test_postprocessor_md.c
@@ -27,6 +27,10 @@
#include <stdlib.h>
#include <microhttpd.h>
+#define DEBUG 0
+
+#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
+
/**
* Handler for fatal errors.
*/
@@ -69,10 +73,12 @@ post_data_iterator (void *cls,
uint64_t off,
size_t size)
{
+#if DEBUG
fprintf (stderr,
"%s\t%s\n",
key,
data);
+#endif
if (0 == strcmp (key, "xxxx"))
{
if ( (4 != size) ||
@@ -116,10 +122,12 @@ post_data_iterator2 (void *cls,
{
static char seen[16];
+#if DEBUG
printf ("%s\t%s@ %llu\n",
key,
data,
(unsigned long long) off);
+#endif
if (0 == strcmp (key, "text"))
{
if (off + size > sizeof (seen))
@@ -146,10 +154,12 @@ post_data_iterator3 (void *cls,
uint64_t off,
size_t size)
{
+#if DEBUG
fprintf (stderr,
"%s\t%s\n",
key,
data);
+#endif
if (0 == strcmp (key, "y"))
{
if ( (1 != size) ||
@@ -161,6 +171,31 @@ post_data_iterator3 (void *cls,
}
+static enum MHD_Result
+post_data_iterator4 (void *cls,
+ enum MHD_ValueKind kind,
+ const char *key,
+ const char *filename,
+ const char *content_type,
+ const char *transfer_encoding,
+ const char *data,
+ uint64_t off,
+ size_t size)
+{
+ #if DEBUG
+ fprintf (stderr,
+ "%s\t%s\n",
+ key,
+ data);
+ #endif
+ if (NULL != memchr (data, 'M', size))
+ {
+ found |= 1;
+ }
+ return MHD_YES;
+}
+
+
int
main (int argc, char *argv[])
{
@@ -232,5 +267,35 @@ main (int argc, char *argv[])
if (found != 1)
exit (5);
+
+ postprocessor = malloc (sizeof(struct MHD_PostProcessor) + 131076 + 1);
+ if (NULL == postprocessor)
+ return 77;
+ memset (postprocessor,
+ 0,
+ sizeof (struct MHD_PostProcessor) + 0x1000 + 1);
+ postprocessor->ikvi = post_data_iterator4;
+ postprocessor->encoding = MHD_HTTP_POST_ENCODING_FORM_URLENCODED;
+ postprocessor->buffer_size = 131076;
+ postprocessor->state = PP_Init;
+ postprocessor->skip_rn = RN_Inactive;
+ const char *chunks[] = {
+
"t=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%2C%2Cxxxxx%2C%2Cx%2Cxxxxxxxxxxxxxxxxxxxx%2C%2Cxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%2Cxxxxxxxx%2Cxxxxxxxxxxxxxxxx%2Cxxxxx%2Cxxxxxxx%2C%2Cxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM%2C%2C%2C%2CMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM%2CMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM%2CMMM
[...]
+ "zz",
+ "",
+ };
+ for (unsigned i = 0; i < ARRAY_LENGTH (chunks); ++i)
+ {
+ const char *chunk = chunks[i];
+ MHD_post_process (postprocessor, chunk, strlen (chunk) );
+ }
+ MHD_destroy_post_processor (postprocessor);
+
+ if (found != 1)
+ return 6;
+
return EXIT_SUCCESS;
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libmicrohttpd] branch master updated: another issue found by test from MD,
gnunet <=