You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by du...@apache.org on 2018/08/10 14:03:45 UTC
[trafficserver] branch master 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.
duke8253 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 6f5817b make sure len is smaller than MAX_ENTRY before we use it as the index
6f5817b is described below
commit 6f5817b7002c9247c3f219db89afd7f583cbc1ec
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
---
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;
}
}