gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] 04/05: postprocessor: do not call memcpy() / memmove() w


From: gnunet
Subject: [libmicrohttpd] 04/05: postprocessor: do not call memcpy() / memmove() with zero size
Date: Sun, 12 Sep 2021 18:32:25 +0200

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

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit e724878002ace7dfbd53e4ecdc8093e16ef353fe
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Sun Sep 12 18:11:28 2021 +0300

    postprocessor: do not call memcpy() / memmove() with zero size
---
 src/microhttpd/postprocessor.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/microhttpd/postprocessor.c b/src/microhttpd/postprocessor.c
index abe7b437..076de337 100644
--- a/src/microhttpd/postprocessor.c
+++ b/src/microhttpd/postprocessor.c
@@ -360,9 +360,10 @@ process_value (struct MHD_PostProcessor *pp,
   mhd_assert ( (NULL != value_start) || (NULL == value_end) );
   mhd_assert ( (NULL == last_escape) || (NULL != value_start) );
   /* move remaining input from previous round into processing buffer */
-  memcpy (xbuf,
-          pp->xbuf,
-          pp->xbuf_pos);
+  if (0 != pp->xbuf_pos)
+    memcpy (xbuf,
+            pp->xbuf,
+            pp->xbuf_pos);
   xoff = pp->xbuf_pos;
   pp->xbuf_pos = 0;
   if ( (NULL != last_escape) &&
@@ -460,10 +461,13 @@ process_value (struct MHD_PostProcessor *pp,
     pp->value_offset += xoff;
     if (cut)
       break;
-    xbuf[delta] = '%';        /* undo 0-termination */
-    memmove (xbuf,
-             &xbuf[delta],
-             clen);
+    if (0 != clen)
+    {
+      xbuf[delta] = '%';        /* undo 0-termination */
+      memmove (xbuf,
+               &xbuf[delta],
+               clen);
+    }
     xoff = clen;
   }
 }

-- 
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]