From 5335371b1a06e1ae5db6ea31d7456b3c6730033f Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Tue, 3 Oct 2017 04:01:52 -0700 Subject: [PATCH] ircd::http: Elide the strlcat() for user header generation. --- ircd/http.cc | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/ircd/http.cc b/ircd/http.cc index d28cfc71d..29e245e9f 100644 --- a/ircd/http.cc +++ b/ircd/http.cc @@ -344,17 +344,15 @@ ircd::http::request::request(const string_view &host, content.size()) }; - char user_headers[printed_size(headers) + 2 + 1]; auto user_headers_len + char user_headers[printed_size(headers) + 2]; auto user_headers_len { print(user_headers, sizeof(user_headers), headers) }; - static const auto &terminator - { - "\r\n" - }; - - user_headers_len = strlcat(user_headers, terminator, sizeof(user_headers)); + assert(user_headers_len + 3 == sizeof(user_headers)); + user_headers[user_headers_len++] = '\r'; + user_headers[user_headers_len++] = '\n'; + //user_headers[user_headers_len++] = '\0'; const ilist vector {