You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2018/05/08 21:12:22 UTC

[trafficserver] branch master updated: Fix out-of-bounds access in append_string function.

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

zwoop pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new afdf0b1  Fix out-of-bounds access in append_string function.
afdf0b1 is described below

commit afdf0b190a34756579a161fef9f184e8a4776c93
Author: jrushford <jr...@apache.org>
AuthorDate: Mon May 7 15:29:37 2018 +0100

    Fix out-of-bounds access in append_string function.
---
 tools/jtest/jtest.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/jtest/jtest.cc b/tools/jtest/jtest.cc
index c19eb4c..d419bc0 100644
--- a/tools/jtest/jtest.cc
+++ b/tools/jtest/jtest.cc
@@ -519,8 +519,8 @@ static inline void
 append_string(char *dest, const char *src, int *offset_ptr, int max_len)
 {
   int num = strlen(src);
-  if (*offset_ptr + num > max_len) {
-    num = max_len - *offset_ptr;
+  if (*offset_ptr + num >= max_len) {
+    num = max_len - (*offset_ptr + 1);
   }
   strncpy(dest + *offset_ptr, src, num + 1);
   (*offset_ptr) += num;

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