From d7ac6f747db9562f617566b519d57bf1ecc4d91a Mon Sep 17 00:00:00 2001 From: Mikkel Krautz Date: Wed, 24 Aug 2016 23:52:04 +0200 Subject: [PATCH] OSInfo: fix implicit size_t conversion. --- src/OSInfo.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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.