You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ma...@apache.org on 2018/02/07 00:15:17 UTC

[trafficserver] branch master updated: Use CRYPTO_HEX_SIZE instead of hardcoded fixed sizes.

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

maskit 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 22559f0  Use CRYPTO_HEX_SIZE instead of hardcoded fixed sizes.
22559f0 is described below

commit 22559f0f48c0651d0300952b1262507fa9e49853
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Tue Feb 6 11:31:22 2018 +0900

    Use CRYPTO_HEX_SIZE instead of hardcoded fixed sizes.
---
 iocore/cache/Cache.cc     |  2 +-
 iocore/cache/CacheHttp.cc |  2 +-
 iocore/cache/CacheRead.cc | 16 ++++++++--------
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc
index 5895716..e464e19 100644
--- a/iocore/cache/Cache.cc
+++ b/iocore/cache/Cache.cc
@@ -2354,7 +2354,7 @@ CacheVC::handleReadDone(int event, Event *e)
 #endif
 
     if (is_debug_tag_set("cache_read")) {
-      char xt[33];
+      char xt[CRYPTO_HEX_SIZE];
       Debug("cache_read", "Read complete on fragment %s. Length: data payload=%d this fragment=%d total doc=%" PRId64 " prefix=%d",
             doc->key.toHexStr(xt), doc->data_len(), doc->len, doc->total_len, doc->prefix_len());
     }
diff --git a/iocore/cache/CacheHttp.cc b/iocore/cache/CacheHttp.cc
index 315a7b9..8eae2ed 100644
--- a/iocore/cache/CacheHttp.cc
+++ b/iocore/cache/CacheHttp.cc
@@ -126,7 +126,7 @@ CacheHTTPInfoVector::clear(bool destroy)
 void
 CacheHTTPInfoVector::print(char *buffer, size_t buf_size, bool temps)
 {
-  char buf[33], *p;
+  char buf[CRYPTO_HEX_SIZE], *p;
   int purl;
   int i, tmp;
 
diff --git a/iocore/cache/CacheRead.cc b/iocore/cache/CacheRead.cc
index 5547c19..40b318d 100644
--- a/iocore/cache/CacheRead.cc
+++ b/iocore/cache/CacheRead.cc
@@ -573,7 +573,7 @@ CacheVC::openReadReadDone(int event, Event *e)
     {
       doc = (Doc *)buf->data();
       if (doc->magic != DOC_MAGIC) {
-        char tmpstring[100];
+        char tmpstring[CRYPTO_HEX_SIZE];
         if (doc->magic == DOC_CORRUPT) {
           Warning("Middle: Doc checksum does not match for %s", key.toHexStr(tmpstring));
         } else {
@@ -619,7 +619,7 @@ CacheVC::openReadReadDone(int event, Event *e)
     // fall through for truncated documents
   }
 Lerror : {
-  char tmpstring[100];
+  char tmpstring[CRYPTO_HEX_SIZE];
   if (request.valid()) {
     int url_length;
     const char *url_text = request.url_get()->string_get_ref(&url_length);
@@ -656,7 +656,7 @@ CacheVC::openReadMain(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
     }
     HTTPInfo::FragOffset *frags = alternate.get_frag_table();
     if (is_debug_tag_set("cache_seek")) {
-      char b[33], c[33];
+      char b[CRYPTO_HEX_SIZE], c[CRYPTO_HEX_SIZE];
       Debug("cache_seek", "Seek @ %" PRId64 " in %s from #%d @ %" PRId64 "/%d:%s", seek_to, first_key.toHexStr(b), fragment,
             doc_pos, doc->len, doc->key.toHexStr(c));
     }
@@ -702,7 +702,7 @@ CacheVC::openReadMain(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
         }
 
         if (is_debug_tag_set("cache_seek")) {
-          char target_key_str[33];
+          char target_key_str[CRYPTO_HEX_SIZE];
           key.toHexStr(target_key_str);
           Debug("cache_seek", "Seek #%d @ %" PRId64 " -> #%d @ %" PRId64 ":%s", cfi, doc_pos, target, seek_to, target_key_str);
         }
@@ -718,7 +718,7 @@ CacheVC::openReadMain(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
     ntodo     = vio.ntodo();
     bytes     = doc->len - doc_pos;
     if (is_debug_tag_set("cache_seek")) {
-      char target_key_str[33];
+      char target_key_str[CRYPTO_HEX_SIZE];
       key.toHexStr(target_key_str);
       Debug("cache_seek", "Read # %d @ %" PRId64 "/%d for %" PRId64, fragment, doc_pos, doc->len, bytes);
     }
@@ -846,7 +846,7 @@ CacheVC::openReadStartEarliest(int /* event ATS_UNUSED */, Event * /* e ATS_UNUS
     }
     doc = (Doc *)buf->data();
     if (doc->magic != DOC_MAGIC) {
-      char tmpstring[100];
+      char tmpstring[CRYPTO_HEX_SIZE];
       if (is_action_tag_set("cache")) {
         ink_release_assert(false);
       }
@@ -1048,7 +1048,7 @@ CacheVC::openReadStartHead(int event, Event *e)
     }
     doc = (Doc *)buf->data();
     if (doc->magic != DOC_MAGIC) {
-      char tmpstring[100];
+      char tmpstring[CRYPTO_HEX_SIZE];
       if (is_action_tag_set("cache")) {
         ink_release_assert(false);
       }
@@ -1144,7 +1144,7 @@ CacheVC::openReadStartHead(int event, Event *e)
     }
 
     if (is_debug_tag_set("cache_read")) { // amc debug
-      char xt[33], yt[33];
+      char xt[CRYPTO_HEX_SIZE], yt[CRYPTO_HEX_SIZE];
       Debug("cache_read", "CacheReadStartHead - read %s target %s - %s %d of %" PRId64 " bytes, %d fragments",
             doc->key.toHexStr(xt), key.toHexStr(yt), f.single_fragment ? "single" : "multi", doc->len, doc->total_len,
             alternate.get_frag_offset_count());

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