diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2021-08-09 18:26:59 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2021-08-11 14:01:55 +0200 |
commit | bb49d2ec026d72db8d5ae678605d6fb9f94a9e0f (patch) | |
tree | 8315f5e8c2d8f9e5179a384cd8b7e33713830cea /src/corelib/io/qstorageinfo_unix.cpp | |
parent | 1e085b9e15abeb45bbbf7995818fcd9c94bfefe1 (diff) |
Correct QStorageIterator::next()'s use of qstrtoll()
The end-pointer out-parameter of qstrtoll() is set to the start of the
subject string on failure, never to nullptr; and this only happens
when ok gets set false in any case, so there's no need to check for it
as well as checking ok.
Change-Id: I852a77a2398ffdcd5cb0671a586362cd578b6df4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/io/qstorageinfo_unix.cpp')
-rw-r--r-- | src/corelib/io/qstorageinfo_unix.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/corelib/io/qstorageinfo_unix.cpp b/src/corelib/io/qstorageinfo_unix.cpp index 6845a24838..6bb1978970 100644 --- a/src/corelib/io/qstorageinfo_unix.cpp +++ b/src/corelib/io/qstorageinfo_unix.cpp @@ -1,5 +1,6 @@ /**************************************************************************** ** +** Copyright (C) 2021 The Qt Company Ltd. ** Copyright (C) 2014 Ivan Komissarov <ABBAPOH@gmail.com> ** Copyright (C) 2016 Intel Corporation. ** Contact: https://www.qt.io/licensing/ @@ -488,21 +489,21 @@ inline bool QStorageIterator::next() mnt.mnt_passno = 0; mnt.mount_id = qstrtoll(ptr, const_cast<const char **>(&ptr), 10, &ok); - if (!ptr || !ok) + if (!ok) return false; int parent_id = qstrtoll(ptr, const_cast<const char **>(&ptr), 10, &ok); Q_UNUSED(parent_id); - if (!ptr || !ok) + if (!ok) return false; int rdevmajor = qstrtoll(ptr, const_cast<const char **>(&ptr), 10, &ok); - if (!ptr || !ok) + if (!ok) return false; if (*ptr != ':') return false; int rdevminor = qstrtoll(ptr + 1, const_cast<const char **>(&ptr), 10, &ok); - if (!ptr || !ok) + if (!ok) return false; mnt.rdev = makedev(rdevmajor, rdevminor); |