@@ -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
32333233inline 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
35283528template <typename ... Args>
35293529inline 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