[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 03/05: postprocessor: fixed undefined behavior error
From: |
gnunet |
Subject: |
[libmicrohttpd] 03/05: postprocessor: fixed undefined behavior error |
Date: |
Sun, 12 Sep 2021 18:32:24 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 6c2f3cf24f4a03b1eb3689d7913c11c7671c948f
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Sun Sep 12 18:08:03 2021 +0300
postprocessor: fixed undefined behavior error
memcpy() must be called with valid pointers even if size is zero.
Sanitizer doesn't like 'zero pointer with zero offset' as well.
---
src/microhttpd/postprocessor.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/microhttpd/postprocessor.c b/src/microhttpd/postprocessor.c
index 74f50af5..abe7b437 100644
--- a/src/microhttpd/postprocessor.c
+++ b/src/microhttpd/postprocessor.c
@@ -385,11 +385,14 @@ process_value (struct MHD_PostProcessor *pp,
if (delta > XBUF_SIZE - xoff)
delta = XBUF_SIZE - xoff;
/* move (additional) input into processing buffer */
- memcpy (&xbuf[xoff],
- value_start,
- delta);
- xoff += delta;
- value_start += delta;
+ if (0 != delta)
+ {
+ memcpy (&xbuf[xoff],
+ value_start,
+ delta);
+ xoff += delta;
+ value_start += delta;
+ }
/* find if escape sequence is at the end of the processing buffer;
if so, exclude those from processing (reduce delta to point at
end of processed region) */
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.