1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2025-07-07 08:14:58 +03:00

Use "%S" instead of "%s" for LA_SET_PORTS_UDP and LA_SET_PROTO_OPTIONS

Turns out %S refers to ANSI/UTF-8 and %s to UTF-16.

This commit fixes a buffer overflow reported by AddressSanitizer and removes an unnecessary conversion to UTF-16.
This commit is contained in:
Davide Beatrici
2021-06-27 21:08:26 +02:00
parent ce6ea9f781
commit 46ca5f7b98
8 changed files with 16 additions and 18 deletions

View File

@ -10077,8 +10077,7 @@ UINT StSetPortsUDP(ADMIN *a, RPC_PORTS *t)
LockList(server_ports);
{
char tmp[MAX_SIZE];
wchar_t str[MAX_SIZE];
char str[MAX_SIZE];
for (i = 0; i < LIST_NUM(server_ports); ++i)
{
@ -10094,8 +10093,7 @@ UINT StSetPortsUDP(ADMIN *a, RPC_PORTS *t)
ProtoSetUdpPorts(a->Server->Proto, server_ports);
IntListToStr(tmp, sizeof(tmp), server_ports, ", ");
StrToUni(str, sizeof(str), tmp);
IntListToStr(str, sizeof(str), server_ports, ", ");
ALog(a, NULL, "LA_SET_PORTS_UDP", str);
}
UnlockList(server_ports);