Do not use _countof, use sizeof(label)/sizeof(wchar_t) or make label std::array<wchar_t, 128> and call .size()

This commit is contained in:
Siepert123 2026-03-04 21:37:38 +01:00
parent 760c49a72b
commit 91a4fc2f6c

View file

@ -762,7 +762,7 @@ void CPlatformNetworkManagerStub::SearchForGames()
//Add server to the list!
FriendSessionInfo* info = new FriendSessionInfo();
wchar_t label[128];
wcsncpy_s(label, _countof(label), name.c_str(), _TRUNCATE);
wcsncpy_s(label, sizeof(label)/sizeof(wchar_t), name.c_str(), _TRUNCATE);
size_t nameLen = wcslen(label);
info->displayLabel = new wchar_t[nameLen+1];
wcscpy_s(info->displayLabel, nameLen + 1, label);