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>
This commit is contained in:
parent
1e085b9e15
commit
bb49d2ec02
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user