diff options
author | Xizhi Zhu <xizhi.zhu@nokia.com> | 2011-03-23 11:00:49 (GMT) |
---|---|---|
committer | Xizhi Zhu <xizhi.zhu@nokia.com> | 2011-03-23 11:00:49 (GMT) |
commit | 551ba5eb80bb8e4e522154f43abf864b8bf5146d (patch) | |
tree | 07c1426c8f9aeb3cdd0e99127acf3492dbf35bf1 /src/plugins/bearer/icd | |
parent | fe3b07884cf2a9c02a5dc3a8fc7aebcd42a5ee91 (diff) | |
download | Qt-551ba5eb80bb8e4e522154f43abf864b8bf5146d.zip Qt-551ba5eb80bb8e4e522154f43abf864b8bf5146d.tar.gz Qt-551ba5eb80bb8e4e522154f43abf864b8bf5146d.tar.bz2 |
Fixes QT-4753
Invalid read in ICD plugin for bearer management.
Reviewed-by: Iiro Kause
Diffstat (limited to 'src/plugins/bearer/icd')
-rw-r--r-- | src/plugins/bearer/icd/dbusdispatcher.cpp | 9 | ||||
-rw-r--r-- | src/plugins/bearer/icd/qnetworksession_impl.cpp | 14 |
2 files changed, 13 insertions, 10 deletions
diff --git a/src/plugins/bearer/icd/dbusdispatcher.cpp b/src/plugins/bearer/icd/dbusdispatcher.cpp index 13cd8a9..a317cb4 100644 --- a/src/plugins/bearer/icd/dbusdispatcher.cpp +++ b/src/plugins/bearer/icd/dbusdispatcher.cpp @@ -194,18 +194,21 @@ static bool appendVariantToDBusMessage(const QVariant& argument, &int32_data); break; - case QVariant::String: - str_data = argument.toString().toLatin1().data(); + case QVariant::String: { + QByteArray data = argument.toString().toLatin1(); + str_data = data.data(); dbus_message_iter_append_basic(dbus_iter, DBUS_TYPE_STRING, &str_data); break; + } case QVariant::StringList: str_list = argument.toStringList(); dbus_message_iter_open_container(dbus_iter, DBUS_TYPE_ARRAY, "s", &array_iter); for (idx = 0; idx < str_list.size(); idx++) { - str_data = str_list.at(idx).toLatin1().data(); + QByteArray data = str_list.at(idx).toLatin1(); + str_data = data.data(); dbus_message_iter_append_basic(&array_iter, DBUS_TYPE_STRING, &str_data); diff --git a/src/plugins/bearer/icd/qnetworksession_impl.cpp b/src/plugins/bearer/icd/qnetworksession_impl.cpp index af5d85e..94a6c81 100644 --- a/src/plugins/bearer/icd/qnetworksession_impl.cpp +++ b/src/plugins/bearer/icd/qnetworksession_impl.cpp @@ -621,21 +621,21 @@ static QString get_network_interface() if (ret == 0) { /* No results */ #ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "Cannot get addrinfo from icd, are you connected or is icd running?"; + qDebug() << "Cannot get addrinfo from icd, are you connected or is icd running?"; #endif - return iface; + return iface; } if (addr_results.first().ip_info.isEmpty()) - return QString(); + return QString(); - const char *address = addr_results.first().ip_info.first().address.toAscii().constData(); + QByteArray data = addr_results.first().ip_info.first().address.toAscii(); struct in_addr addr; - if (inet_aton(address, &addr) == 0) { + if (inet_aton(data.constData(), &addr) == 0) { #ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "address" << address << "invalid"; + qDebug() << "address" << data.constData() << "invalid"; #endif - return iface; + return iface; } struct ifaddrs *ifaddr, *ifa; |