Skip to content

Commit 04bfb45

Browse files
Fix potential unterminated string in logging in state machine.
1 parent 726c2d3 commit 04bfb45

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

proxy/http/HttpSM.cc

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
#include <openssl/ssl.h>
5050
#include <algorithm>
5151
#include <atomic>
52+
#include <logging/Log.h>
5253

5354
#define DEFAULT_RESPONSE_BUFFER_SIZE_INDEX 6 // 8K
5455
#define DEFAULT_REQUEST_BUFFER_SIZE_INDEX 6 // 8K
@@ -5217,9 +5218,12 @@ HttpSM::mark_host_failure(HostDBInfo *info, time_t time_down)
52175218
if (info->app.http_data.last_failure == 0) {
52185219
char *url_str = t_state.hdr_info.client_request.url_string_get(&t_state.arena, nullptr);
52195220
Log::error("%s", lbw()
5220-
.print("CONNECT: could not connect to {} for '{}' (setting last failure time) connect_result={}\0",
5221-
t_state.current.server->dst_addr, url_str ? url_str : "<none>",
5222-
ts::bwf::Errno(t_state.current.server->connect_result))
5221+
.clip(1)
5222+
.print("CONNECT Error: {} connecting to {} for '{}' (setting last failure time)",
5223+
ts::bwf::Errno(t_state.current.server->connect_result), t_state.current.server->dst_addr,
5224+
ts::bwf::FirstOf(url_str, "<none>"))
5225+
.extend(1)
5226+
.write('\0')
52235227
.data());
52245228

52255229
if (url_str) {

0 commit comments

Comments
 (0)