This commit is contained in:
yhirose 2021-11-15 14:37:10 -05:00 committed by GitHub
parent 943cd51b67
commit ec56dfa35e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1487,10 +1487,10 @@ inline T Response::get_header_value(const char *key, size_t id) const {
template <typename... Args> template <typename... Args>
inline ssize_t Stream::write_format(const char *fmt, const Args &...args) { inline ssize_t Stream::write_format(const char *fmt, const Args &...args) {
const auto bufsiz = 2048; const auto bufsiz = 2048;
std::array<char, bufsiz> buf; std::array<char, bufsiz> buf{};
#if defined(_MSC_VER) && _MSC_VER < 1900 #if defined(_MSC_VER) && _MSC_VER < 1900
auto sn = _snprintf_s(buf.data(), bufsiz - 1, buf.size() - 1, fmt, args...); auto sn = _snprintf_s(buf.data(), bufsiz, _TRUNCATE, fmt, args...);
#else #else
auto sn = snprintf(buf.data(), buf.size() - 1, fmt, args...); auto sn = snprintf(buf.data(), buf.size() - 1, fmt, args...);
#endif #endif
@ -5673,7 +5673,7 @@ inline void ClientImpl::close_socket(Socket &socket) {
inline bool ClientImpl::read_response_line(Stream &strm, const Request &req, inline bool ClientImpl::read_response_line(Stream &strm, const Request &req,
Response &res) { Response &res) {
std::array<char, 2048> buf; std::array<char, 2048> buf{};
detail::stream_line_reader line_reader(strm, buf.data(), buf.size()); detail::stream_line_reader line_reader(strm, buf.data(), buf.size());