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 061c3cf2ac1c5047cf9adaf771b030a1605b357b
Author: Andrew Stitcher <astitc...@apache.org>
AuthorDate: Tue Jun 22 16:39:48 2021 -0400

    PROTON-2426: [C] Fix off by one error in pn_quote_data
---
 c/src/core/util.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/c/src/core/util.c b/c/src/core/util.c
index 18a9464..bed2a54 100644
--- a/c/src/core/util.c
+++ b/c/src/core/util.c
@@ -46,7 +46,7 @@ ssize_t pn_quote_data(char *dst, size_t capacity, const char 
*src, size_t size)
         dst[idx++] = c;
       } else {
         if (idx > 0) {
-          dst[idx - 1] = '\0';
+          dst[idx] = '\0';
         }
         return PN_OVERFLOW;
       }
@@ -55,7 +55,7 @@ ssize_t pn_quote_data(char *dst, size_t capacity, const char 
*src, size_t size)
         idx += sprintf(dst + idx, "\\x%.2x", c);
       } else {
         if (idx > 0) {
-          dst[idx - 1] = '\0';
+          dst[idx] = '\0';
         }
         return PN_OVERFLOW;
       }

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org
For additional commands, e-mail: commits-h...@qpid.apache.org

Reply via email to