summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Zajac <guillaume.zajac@linux.intel.com>2012-06-27 17:00:29 +0200
committerMarcel Holtmann <marcel@holtmann.org>2012-06-30 10:33:04 +0200
commit8beabba8c702d04e7de5ad04d6ecbcf5b91e24ce (patch)
tree5c6200b5b25bab4a211f06c6d0468b3ddc5c5cc1
parentc189a9ab8a085447b775c7fbeb0a8050751b7f84 (diff)
downloadconnman-8beabba8c702d04e7de5ad04d6ecbcf5b91e24ce.tar.gz
connman-8beabba8c702d04e7de5ad04d6ecbcf5b91e24ce.tar.bz2
connman-8beabba8c702d04e7de5ad04d6ecbcf5b91e24ce.zip
ofono: Fix potential crash
If a dummy context is created, it might happen that its index is equal to -1. In this particular case the IP address has not been copied to context->address during ipv4 extraction. If we force from oFono a context activation, it will make ConnMan crashing on set_connected().
-rw-r--r--plugins/ofono.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/plugins/ofono.c b/plugins/ofono.c
index ae419be4..d284c2be 100644
--- a/plugins/ofono.c
+++ b/plugins/ofono.c
@@ -260,6 +260,12 @@ static void set_connected(struct modem_data *modem)
DBG("%s", modem->path);
+ if (modem->context->index < 0 ||
+ modem->context->ipv4_address == NULL) {
+ connman_error("Invalid index and/or address");
+ return;
+ }
+
connman_network_set_index(modem->network, modem->context->index);
switch (modem->context->ipv4_method) {