api: fix trailing number detection in RemoveNumberedSuffix()

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2020-07-28 11:46:30 +02:00 committed by Jason A. Donenfeld
parent 5925f914e4
commit c8711464bb

View File

@ -336,7 +336,7 @@ static void
RemoveNumberedSuffix(_In_z_ const WCHAR *Name, _Out_ WCHAR *Removed) RemoveNumberedSuffix(_In_z_ const WCHAR *Name, _Out_ WCHAR *Removed)
{ {
size_t Len = wcslen(Name); size_t Len = wcslen(Name);
if (Len && Name[Len - 1] < L'0' || Name[Len - 1] > L'9') if (Len && (Name[Len - 1] < L'0' || Name[Len - 1] > L'9'))
{ {
wmemcpy(Removed, Name, Len + 1); wmemcpy(Removed, Name, Len + 1);
return; return;