1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-22 17:39:53 +03:00

Compare commits

...

4 Commits

Author SHA1 Message Date
Ilya Shipitsin
5cf45ad62b
Merge pull request #1981 from hiura2023/master
Fix 'RemoveDefGwOnDhcpForLocalhost' function No.2: Change the minimum size of DHCP reply
2024-04-16 22:31:21 +02:00
hiura2023
ac28302b59
Merge branch 'SoftEtherVPN:master' into master 2024-04-16 19:16:20 +09:00
hiura
9a009d750a Use macro 'MAX' instead of 'max' 2024-04-16 19:14:44 +09:00
hiura
c36d7187a8 Fix 'RemoveDefGwOnDhcpForLocalhost' function No.2: Change the minimum size of DHCP reply 2024-04-16 10:30:10 +09:00

View File

@ -4168,6 +4168,7 @@ BUF *DhcpModify(DHCP_MODIFY_OPTION *m, void *data, UINT size)
LIST *opt_list2 = NULL;
UINT src_size = size;
UINT i;
UINT dhcp_min_size;
// Validate arguments
if (m == NULL || data == NULL || size == 0)
{
@ -4270,11 +4271,13 @@ BUF *DhcpModify(DHCP_MODIFY_OPTION *m, void *data, UINT size)
// Rewrite if anything changes. Do not rewrite if there is no change
ret_ok = true;
if (ret->Size < DHCP_MIN_SIZE)
// If src_size is greater than DHCP_MIN_SIZE, then use the src_size as minimum size of DHCP.
dhcp_min_size = MAX(src_size, DHCP_MIN_SIZE);
if (ret->Size < dhcp_min_size)
{
// Padding
UCHAR *pad_buf;
UINT pad_size = DHCP_MIN_SIZE - ret->Size;
UINT pad_size = dhcp_min_size - ret->Size;
pad_buf = ZeroMalloc(pad_size);