diff --git a/src/OSInfo.cpp b/src/OSInfo.cpp index bdad3aab8..b73c719f7 100644 --- a/src/OSInfo.cpp +++ b/src/OSInfo.cpp @@ -34,7 +34,9 @@ static QString regString(wchar_t *string, int size) { // that the NUL is not included in the returned // string. const size_t adjustedSize = wcsnlen(string, static_cast(size)); - return QString::fromWCharArray(string, adjustedSize); + // The return value of wcsnlen is <= size which is + // an int, so casting adjustedSize to int is safe. + return QString::fromWCharArray(string, static_cast(adjustedSize)); } /// Query for a Windows 10-style displayable version.