From 51d333e76e7f8a3fd9f153f7a168b248fc13d43c Mon Sep 17 00:00:00 2001 From: Mikkel Krautz Date: Sun, 21 Aug 2016 12:58:45 +0200 Subject: [PATCH] OSInfo: fix implicit size_t conversion. --- src/OSInfo.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/OSInfo.cpp b/src/OSInfo.cpp index bdad3aab818..325c9ce5ea9 100644 --- a/src/OSInfo.cpp +++ b/src/OSInfo.cpp @@ -34,7 +34,10 @@ 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); + if (adjustedSize > INT_MAX) { + return QString(); + } + return QString::fromWCharArray(string, static_cast(adjustedSize)); } /// Query for a Windows 10-style displayable version.