diff options
author | Ivan Komissarov <ABBAPOH@gmail.com> | 2018-10-20 17:34:54 +0200 |
---|---|---|
committer | Ivan Komissarov <ABBAPOH@gmail.com> | 2018-10-20 20:41:15 +0000 |
commit | 5d61fd8c22b569b3127491e8e42bd9e646e3144a (patch) | |
tree | d313ed9e7100c68f1a33df6011a8525a67dc0bd3 /src | |
parent | cea2b5510c28d1057018007d65589fecee62b0d8 (diff) |
qfilesystemengine: add missed Q_CHECK_PTR
There might be dereferencing of a potential null pointer
Task-number: QTBUG-71156
Change-Id: I202d314d001917a2de0500caf762d2b54ff517cb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/io/qfilesystemengine_win.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp index 74081b4ffa..a796fd005a 100644 --- a/src/corelib/io/qfilesystemengine_win.cpp +++ b/src/corelib/io/qfilesystemengine_win.cpp @@ -204,10 +204,12 @@ GlobalSid::GlobalSid() ::GetTokenInformation(token, TokenUser, 0, 0, &retsize); if (retsize) { void *tokenBuffer = malloc(retsize); + Q_CHECK_PTR(tokenBuffer); if (::GetTokenInformation(token, TokenUser, tokenBuffer, retsize, &retsize)) { PSID tokenSid = reinterpret_cast<PTOKEN_USER>(tokenBuffer)->User.Sid; DWORD sidLen = ::GetLengthSid(tokenSid); currentUserSID = reinterpret_cast<PSID>(malloc(sidLen)); + Q_CHECK_PTR(currentUserSID); if (::CopySid(sidLen, currentUserSID, tokenSid)) BuildTrusteeWithSid(¤tUserTrusteeW, currentUserSID); } @@ -294,6 +296,7 @@ static QString readSymLink(const QFileSystemEntry &link) if (handle != INVALID_HANDLE_VALUE) { DWORD bufsize = MAXIMUM_REPARSE_DATA_BUFFER_SIZE; REPARSE_DATA_BUFFER *rdb = (REPARSE_DATA_BUFFER*)malloc(bufsize); + Q_CHECK_PTR(rdb); DWORD retsize = 0; if (::DeviceIoControl(handle, FSCTL_GET_REPARSE_POINT, 0, 0, rdb, bufsize, &retsize, 0)) { if (rdb->ReparseTag == IO_REPARSE_TAG_MOUNT_POINT) { |