0
0
mirror of https://github.com/OpenVPN/openvpn3.git synced 2024-09-19 19:52:15 +02:00

WriteFile takes DWORD, not size_t

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
This commit is contained in:
Frank Lichtenheld 2023-08-23 18:28:18 +02:00 committed by David Sommerseth
parent a52371a267
commit 2e10d21fa2
No known key found for this signature in database
GPG Key ID: 86CF944C9671FDF2
2 changed files with 4 additions and 2 deletions

View File

@ -499,7 +499,9 @@ class MyListener : public WS::Server::Listener
// write management password to process's stdin
DWORD written;
WriteFile(stdin_write, management_password.c_str(), management_password.length(), &written, NULL);
if (!is_safe_conversion<DWORD>(management_password.length()))
return;
WriteFile(stdin_write, management_password.c_str(), static_cast<DWORD>(management_password.length()), &written, NULL);
}
}
#endif

View File

@ -40,7 +40,7 @@ inline void log(const HANDLE file, const std::string &str)
{
DWORD n_written;
const std::string line = date_time() + ' ' + str;
::WriteFile(file, line.c_str(), line.length(), &n_written, NULL);
::WriteFile(file, line.c_str(), static_cast<DWORD>(line.length()), &n_written, NULL);
}
inline ScopedHANDLE create_file(const std::string &fn,