From 88dd8a25d8a15c92ae7aae391734dc7bcaade39d Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Tue, 13 Sep 2011 14:38:09 +0200 Subject: [PATCH] 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 Reviewed-by: Gabriel de Dietrich --- src/plugins/bearer/icd/qicdengine.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/bearer/icd/qicdengine.cpp b/src/plugins/bearer/icd/qicdengine.cpp index c793e52cf9..d79a513ec4 100644 --- a/src/plugins/bearer/icd/qicdengine.cpp +++ b/src/plugins/bearer/icd/qicdengine.cpp @@ -883,12 +883,12 @@ void QIcdEngine::connectionStateSignalsSlot(QDBusMessage msg) QMutexLocker locker(&mutex); QList 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: