From 8b0409ce2a279e53a1db9bc3c567476880861f7f Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Fri, 30 Oct 2020 06:57:56 +0100 Subject: [PATCH] api: fix adapter name numbering termination Reported-by: Jason A. Donenfeld Signed-off-by: Simon Rozman --- api/adapter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/adapter.c b/api/adapter.c index a2f7818..790ed53 100644 --- a/api/adapter.c +++ b/api/adapter.c @@ -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)