gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] branch master updated: Fixes for 32-bit platforms


From: gnunet
Subject: [libmicrohttpd] branch master updated: Fixes for 32-bit platforms
Date: Wed, 31 Jan 2024 10:34:44 +0100

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

The following commit(s) were added to refs/heads/master by this push:
     new 086fcdac Fixes for 32-bit platforms
086fcdac is described below

commit 086fcdacbb6dae97eaf9ad02874c77b9251d91c1
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Wed Jan 31 10:33:03 2024 +0100

    Fixes for 32-bit platforms
---
 doc/examples/sessions.c             | 12 ++++++++----
 src/examples/chunked_example.c      |  2 +-
 src/examples/post_example.c         |  8 ++++++--
 src/microhttpd/test_postprocessor.c |  6 ++++--
 src/testcurl/test_concurrent_stop.c | 10 +++++++++-
 5 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/doc/examples/sessions.c b/doc/examples/sessions.c
index 0544a2d7..86caaa20 100644
--- a/doc/examples/sessions.c
+++ b/doc/examples/sessions.c
@@ -524,8 +524,10 @@ post_iterator (void *cls,
   }
   if (0 == strcmp ("v1", key))
   {
-    if (size + off > sizeof(session->value_1))
-      size = sizeof (session->value_1) - off;
+    if (off >= sizeof(session->value_1) - 1)
+      return MHD_YES; /* Discard extra data */
+    if (size + off >= sizeof(session->value_1))
+      size = (size_t) (sizeof (session->value_1) - off - 1); /* crop extra 
data */
     memcpy (&session->value_1[off],
             data,
             size);
@@ -535,8 +537,10 @@ post_iterator (void *cls,
   }
   if (0 == strcmp ("v2", key))
   {
-    if (size + off > sizeof(session->value_2))
-      size = sizeof (session->value_2) - off;
+    if (off >= sizeof(session->value_2) - 1)
+      return MHD_YES; /* Discard extra data */
+    if (size + off >= sizeof(session->value_2))
+      size = (size_t) (sizeof (session->value_2) - off - 1); /* crop extra 
data */
     memcpy (&session->value_2[off],
             data,
             size);
diff --git a/src/examples/chunked_example.c b/src/examples/chunked_example.c
index 12d07d90..d0dacc64 100644
--- a/src/examples/chunked_example.c
+++ b/src/examples/chunked_example.c
@@ -62,7 +62,7 @@ callback (void *cls,
   if (buf_size < (param->response_size - pos))
     size_to_copy = buf_size;
   else
-    size_to_copy = param->response_size - pos;
+    size_to_copy = (size_t) (param->response_size - pos);
 
   memcpy (buf, param->response_data + pos, size_to_copy);
 
diff --git a/src/examples/post_example.c b/src/examples/post_example.c
index 2edf1f99..693ad321 100644
--- a/src/examples/post_example.c
+++ b/src/examples/post_example.c
@@ -520,8 +520,10 @@ post_iterator (void *cls,
   }
   if (0 == strcmp ("v1", key))
   {
+    if (off >= sizeof(session->value_1) - 1)
+      return MHD_YES; /* Discard extra data */
     if (size + off >= sizeof(session->value_1))
-      size = sizeof (session->value_1) - off - 1;
+      size = (size_t) (sizeof (session->value_1) - off - 1); /* crop extra 
data */
     memcpy (&session->value_1[off],
             data,
             size);
@@ -530,8 +532,10 @@ post_iterator (void *cls,
   }
   if (0 == strcmp ("v2", key))
   {
+    if (off >= sizeof(session->value_2) - 1)
+      return MHD_YES; /* Discard extra data */
     if (size + off >= sizeof(session->value_2))
-      size = sizeof (session->value_2) - off - 1;
+      size = (size_t) (sizeof (session->value_2) - off - 1); /* crop extra 
data */
     memcpy (&session->value_2[off],
             data,
             size);
diff --git a/src/microhttpd/test_postprocessor.c 
b/src/microhttpd/test_postprocessor.c
index f7a88f11..253034bb 100644
--- a/src/microhttpd/test_postprocessor.c
+++ b/src/microhttpd/test_postprocessor.c
@@ -183,7 +183,8 @@ value_checker (void *cls,
       (mismatch (filename, expect->fname)) ||
       (mismatch (content_type, expect->cnt_type)) ||
       (mismatch (transfer_encoding, expect->tr_enc)) ||
-      (mismatch2 (data, expect->data, off, size)))
+      (strlen (expect->data) < off) ||
+      (mismatch2 (data, expect->data, (size_t) off, size)))
   {
     *idxp = (unsigned int) -1;
     fprintf (stderr,
@@ -208,7 +209,8 @@ value_checker (void *cls,
              (mismatch (filename, expect->fname)),
              (mismatch (content_type, expect->cnt_type)),
              (mismatch (transfer_encoding, expect->tr_enc)),
-             (mismatch2 (data, expect->data, off, size)));
+             (strlen (expect->data) < off)
+             || (mismatch2 (data, expect->data, (size_t) off, size)));
     return MHD_NO;
   }
   if ( ( (NULL == expect->data) &&
diff --git a/src/testcurl/test_concurrent_stop.c 
b/src/testcurl/test_concurrent_stop.c
index eed6bf9a..ae844b05 100644
--- a/src/testcurl/test_concurrent_stop.c
+++ b/src/testcurl/test_concurrent_stop.c
@@ -44,7 +44,15 @@
 /**
  * How many requests do we do in parallel?
  */
-#define PAR (MHD_CPU_COUNT * 4)
+#if SIZEOF_SIZE_T >= 8 || MHD_CPU_COUNT < 8
+#  define PAR (MHD_CPU_COUNT * 4)
+#elif MHD_CPU_COUNT < 16
+/* Limit load */
+#  define PAR (MHD_CPU_COUNT * 2)
+#else
+/* Limit load */
+#  define PAR (MHD_CPU_COUNT * 1)
+#endif
 
 /**
  * Do we use HTTP 1.1?

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]