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 2019/04/24 08:09:28 UTC

[trafficserver] branch master updated: cppcheck: Reduce the scope of the variable 'out_buf'

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

masaori 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 72311cd  cppcheck: Reduce the scope of the variable 'out_buf'
72311cd is described below

commit 72311cd7e41477fba0d90a10e3f2d28ca3e66d2d
Author: Masaori Koshiba <ma...@gmail.com>
AuthorDate: Tue Apr 23 14:57:50 2019 +0800

    cppcheck: Reduce the scope of the variable 'out_buf'
---
 proxy/http2/Http2ClientSession.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/proxy/http2/Http2ClientSession.cc b/proxy/http2/Http2ClientSession.cc
index 2bfd121..eb644e1 100644
--- a/proxy/http2/Http2ClientSession.cc
+++ b/proxy/http2/Http2ClientSession.cc
@@ -213,9 +213,9 @@ Http2ClientSession::set_upgrade_context(HTTPHdr *h)
   int svlen;
   const char *sv = settings->value_get(&svlen);
 
-  // Maybe size of data decoded by Base64URL is lower than size of encoded data.
-  unsigned char out_buf[svlen];
   if (sv && svlen > 0) {
+    // Maybe size of data decoded by Base64URL is lower than size of encoded data.
+    unsigned char out_buf[svlen];
     size_t decoded_len;
     ats_base64_decode(sv, svlen, out_buf, svlen, &decoded_len);
     for (size_t nbytes = 0; nbytes < decoded_len; nbytes += HTTP2_SETTINGS_PARAMETER_LEN) {