This is an automated email from the ASF dual-hosted git repository.

astitcher pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git

commit 97f1a73e80b613f66924ef9c44ca9124435a383c
Author: Andrew Stitcher <[email protected]>
AuthorDate: Thu Nov 4 11:07:47 2021 +0000

    PROTON-2455: Fix to PROTON-2425 for hacky use of pn_buffer in messenger
---
 c/src/core/buffer.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/c/src/core/buffer.c b/c/src/core/buffer.c
index 07491e7..8e7d73d 100644
--- a/c/src/core/buffer.c
+++ b/c/src/core/buffer.c
@@ -176,9 +176,11 @@ int pn_buffer_append(pn_buffer_t *buf, const char *bytes, 
size_t size)
   size_t tail_space = pni_buffer_tail_space(buf);
   size_t n = pn_min(tail_space, size);
 
-  memcpy(buf->bytes + tail, bytes, n);
-  memcpy(buf->bytes, bytes + n, size - n);
-
+  // Heuristic check for a strange usage in messenger
+  if (bytes!=buf->bytes+tail) {
+    memcpy(buf->bytes + tail, bytes, n);
+    memcpy(buf->bytes, bytes + n, size - n);
+  }
   buf->size += size;
 
   return 0;

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to