Skip to content

Commit 5038314

Browse files
committed
Fix #564
1 parent 6e1297c commit 5038314

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

httplib.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3231,7 +3231,7 @@ inline std::string SHA_512(const std::string &s) {
32313231
// NOTE: This code came up with the following stackoverflow post:
32323232
// https://stackoverflow.com/questions/9507184/can-openssl-on-windows-use-the-system-certificate-store
32333233
inline bool load_system_certs_on_windows(X509_STORE *store) {
3234-
auto hStore = CertOpenSystemStore((HCRYPTPROV_LEGACY)NULL, L"ROOT");
3234+
auto hStore = CertOpenSystemStoreW((HCRYPTPROV_LEGACY)NULL, L"ROOT");
32353235

32363236
if (!hStore) { return false; }
32373237

@@ -3527,10 +3527,11 @@ inline ssize_t Stream::write(const std::string &s) {
35273527

35283528
template <typename... Args>
35293529
inline ssize_t Stream::write_format(const char *fmt, const Args &... args) {
3530-
std::array<char, 2048> buf;
3530+
const auto bufsiz = 2048;
3531+
std::array<char, bufsiz> buf;
35313532

35323533
#if defined(_MSC_VER) && _MSC_VER < 1900
3533-
auto sn = _snprintf_s(buf, bufsiz, buf.size() - 1, fmt, args...);
3534+
auto sn = _snprintf_s(buf, bufsiz - 1, buf.size() - 1, fmt, args...);
35343535
#else
35353536
auto sn = snprintf(buf.data(), buf.size() - 1, fmt, args...);
35363537
#endif

0 commit comments

Comments
 (0)