Check argument count before accessing argument.

Also use QList::at instead of operator[].

Fixes: QTBUG-21403
Reviewed-by: Gabi
(cherry picked from commit 6997b836f445908cf53c1c96a69e3eb7ba535706)

Change-Id: I5d9de189e931b2b55fbd7baab0baad94adae352b
Reviewed-on: http://codereview.qt-project.org/4782
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Gabriel de Dietrich <gabriel.dietrich-de@nokia.com>
bb10
Frederik Gladhorn 2011-09-13 14:38:09 +02:00 committed by Qt by Nokia
parent b89ffb404c
commit 88dd8a25d8
1 changed files with 2 additions and 2 deletions

View File

@ -883,12 +883,12 @@ void QIcdEngine::connectionStateSignalsSlot(QDBusMessage msg)
QMutexLocker locker(&mutex);
QList<QVariant> arguments = msg.arguments();
if (arguments[1].toUInt() != 0 || arguments.count() < 8) {
if (arguments.count() < 8 || arguments.at(1).toUInt() != 0) {
return;
}
QString iapid = arguments[5].toByteArray().data();
uint icd_connection_state = arguments[7].toUInt();
uint icd_connection_state = arguments.at(7).toUInt();
switch (icd_connection_state) {
case ICD_STATE_CONNECTED: