api: fix adapter name numbering termination
Reported-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
254a900a76
commit
8b0409ce2a
@ -725,7 +725,7 @@ WintunSetAdapterName(_In_ const WINTUN_ADAPTER *Adapter, _In_z_count_c_(MAX_ADAP
|
||||
}
|
||||
if (Result == ERROR_SUCCESS)
|
||||
break;
|
||||
if (i > MaxSuffix || Result != ERROR_DUP_NAME)
|
||||
if (i >= MaxSuffix || Result != ERROR_DUP_NAME)
|
||||
return LOG_ERROR(L"Setting adapter name failed", Result);
|
||||
if (_snwprintf_s(
|
||||
AvailableName, _countof(AvailableName), _TRUNCATE, L"%.*s %d", MAX_ADAPTER_NAME, Name, i + 1) == -1)
|
||||
|
Loading…
Reference in New Issue
Block a user