# "https://github.com/mackron/miniaudio/raw/refs/tags/0.11.23/miniaudio.h": "vendor/miniaudio/miniaudio.h",
"https://github.com/mackron/miniaudio/raw/669ed3e844524fcd883231b13095baee9f6de304/miniaudio.h": "vendor/miniaudio/miniaudio.h",
- "https://raw.githubusercontent.com/yhirose/cpp-httplib/refs/tags/v0.30.0/httplib.h": "vendor/cpp-httplib/httplib.h",
- "https://raw.githubusercontent.com/yhirose/cpp-httplib/refs/tags/v0.30.0/LICENSE": "vendor/cpp-httplib/LICENSE",
+ "https://raw.githubusercontent.com/yhirose/cpp-httplib/refs/tags/v0.30.1/httplib.h": "vendor/cpp-httplib/httplib.h",
+ "https://raw.githubusercontent.com/yhirose/cpp-httplib/refs/tags/v0.30.1/LICENSE": "vendor/cpp-httplib/LICENSE",
"https://raw.githubusercontent.com/sheredom/subprocess.h/b49c56e9fe214488493021017bf3954b91c7c1f5/subprocess.h": "vendor/sheredom/subprocess.h",
}
return ret;
#elif TARGET_OS_MAC
+ if (!node) { return EAI_NONAME; }
// macOS implementation using CFHost API for asynchronous DNS resolution
CFStringRef hostname_ref = CFStringCreateWithCString(
kCFAllocatorDefault, node, kCFStringEncodingUTF8);
strm, req, res,
// Regular
[&](const char *buf, size_t n) {
- // Prevent arithmetic overflow when checking sizes.
- // Avoid computing (req.body.size() + n) directly because
- // adding two unsigned `size_t` values can wrap around and
- // produce a small result instead of indicating overflow.
- // Instead, check using subtraction: ensure `n` does not
- // exceed the remaining capacity `max_size() - size()`.
- if (req.body.size() >= req.body.max_size() ||
- n > req.body.max_size() - req.body.size()) {
+ // Limit decompressed body size to payload_max_length_ to protect
+ // against "zip bomb" attacks where a small compressed payload
+ // decompresses to a massive size.
+ if (req.body.size() + n > payload_max_length_ ||
+ req.body.size() + n > req.body.max_size()) {
return false;
}
req.body.append(buf, n);
#ifndef CPPHTTPLIB_HTTPLIB_H
#define CPPHTTPLIB_HTTPLIB_H
-#define CPPHTTPLIB_VERSION "0.30.0"
-#define CPPHTTPLIB_VERSION_NUM "0x001E00"
+#define CPPHTTPLIB_VERSION "0.30.1"
+#define CPPHTTPLIB_VERSION_NUM "0x001E01"
/*
* Platform compatibility check
#pragma comment(lib, "ws2_32.lib")
+#ifndef _SSIZE_T_DEFINED
using ssize_t = __int64;
+#define _SSIZE_T_DEFINED
+#endif
#endif // _MSC_VER
#ifndef S_ISREG
#if defined(_WIN32)
inline std::wstring u8string_to_wstring(const char *s) {
- std::wstring ws;
+ if (!s) { return std::wstring(); }
+
auto len = static_cast<int>(strlen(s));
+ if (!len) { return std::wstring(); }
+
auto wlen = ::MultiByteToWideChar(CP_UTF8, 0, s, len, nullptr, 0);
- if (wlen > 0) {
- ws.resize(wlen);
- wlen = ::MultiByteToWideChar(
- CP_UTF8, 0, s, len,
- const_cast<LPWSTR>(reinterpret_cast<LPCWSTR>(ws.data())), wlen);
- if (wlen != static_cast<int>(ws.size())) { ws.clear(); }
- }
+ if (!wlen) { return std::wstring(); }
+
+ std::wstring ws;
+ ws.resize(wlen);
+ wlen = ::MultiByteToWideChar(
+ CP_UTF8, 0, s, len,
+ const_cast<LPWSTR>(reinterpret_cast<LPCWSTR>(ws.data())), wlen);
+ if (wlen != static_cast<int>(ws.size())) { ws.clear(); }
return ws;
}
#endif