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/08/13 18:50:35 UTC
[trafficserver] branch 8.0.x updated: make sure len is smaller than
MAX_ENTRY before we use it as the index
This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch 8.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/8.0.x by this push:
new 40f80dc make sure len is smaller than MAX_ENTRY before we use it as the index
40f80dc is described below
commit 40f80dc800ff97377cf32f12e26551b540f36eec
Author: Fei Deng <du...@gmail.com>
AuthorDate: Thu Aug 9 10:54:39 2018 -0500
make sure len is smaller than MAX_ENTRY before we use it as the index
(cherry picked from commit 6f5817b7002c9247c3f219db89afd7f583cbc1ec)
---
proxy/logging/LogObject.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/proxy/logging/LogObject.cc b/proxy/logging/LogObject.cc
index c953f39..50385e5 100644
--- a/proxy/logging/LogObject.cc
+++ b/proxy/logging/LogObject.cc
@@ -511,14 +511,14 @@ LogObject::va_log(LogAccess *lad, const char *fmt, va_list ap)
if (this->m_flags & LOG_OBJECT_FMT_TIMESTAMP) {
len = LogUtils::timestamp_to_str(LogUtils::timestamp(), entry, MAX_ENTRY);
- if (len <= 0) {
+ if (unlikely(len <= 0 || len >= MAX_ENTRY)) {
return Log::FAIL;
}
// Add a space after the timestamp
entry[len++] = ' ';
- if (len >= MAX_ENTRY) {
+ if (unlikely(len >= MAX_ENTRY)) {
return Log::FAIL;
}
}