summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2011-12-07 17:07:46 -0600
committerDan Williams <dcbw@redhat.com>2011-12-07 17:07:46 -0600
commit2af1a612e9187c0e2bf3a8e3d007f04aa023add9 (patch)
treef3a864e6521e8459bf1bb76840e534bb01f002e3 /plugins
parentc1e64f1a33b8b877945e59bda58b1969cdc27614 (diff)
core: don't crash on error if response is NULL
Various bits of the code didn't check if response was valid or not during error conditions, and when an error occurs sometimes it'll be NULL (since not all errors are translated errors from the modem, some are serial or general ones). We have to make sure we don't try to use response->str when response doesn't exist. Found in the generic CDMA code likely as a result of d5d9eec2b52363a7460aeec0c020b1c6a7af6b03 but was a bug long before that commit happened anyway.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mm-modem-mbm.c4
-rw-r--r--plugins/mm-plugin-longcheer.c3
-rw-r--r--plugins/mm-plugin-x22x.c3
3 files changed, 7 insertions, 3 deletions
diff --git a/plugins/mm-modem-mbm.c b/plugins/mm-modem-mbm.c
index 61499100..65283e47 100644
--- a/plugins/mm-modem-mbm.c
+++ b/plugins/mm-modem-mbm.c
@@ -730,7 +730,9 @@ enap_poll_response (MMAtSerialPort *port,
count = GPOINTER_TO_UINT (mm_callback_info_get_data (info, "mbm-enap-poll-count"));
- if (sscanf (response->str, "*ENAP: %d", &state) == 1 && state == 1) {
+ if ( response
+ && sscanf (response->str, "*ENAP: %d", &state) == 1
+ && state == 1) {
/* Success! Connected... */
mm_generic_gsm_connect_complete (MM_GENERIC_GSM (info->modem), NULL, info);
return;
diff --git a/plugins/mm-plugin-longcheer.c b/plugins/mm-plugin-longcheer.c
index 8124edd4..1570cf4b 100644
--- a/plugins/mm-plugin-longcheer.c
+++ b/plugins/mm-plugin-longcheer.c
@@ -72,12 +72,13 @@ custom_init_response_cb (MMPluginBaseSupportsTask *task,
guint32 *out_level,
gpointer user_data)
{
- const char *p = response->str;
+ const char *p;
if (error)
return tries <= 4 ? TRUE : FALSE;
/* Note the lack of a ':' on the GMR; the X200 doesn't send one */
+ g_assert (response);
p = mm_strip_tag (response->str, "AT+GMR");
if (*p == 'L') {
/* X200 modems have a GMR firmware revision that starts with 'L', and
diff --git a/plugins/mm-plugin-x22x.c b/plugins/mm-plugin-x22x.c
index 059bb51e..10a1b4c8 100644
--- a/plugins/mm-plugin-x22x.c
+++ b/plugins/mm-plugin-x22x.c
@@ -70,12 +70,13 @@ custom_init_response_cb (MMPluginBaseSupportsTask *task,
guint32 *out_level,
gpointer user_data)
{
- const char *p = response->str;
+ const char *p;
if (error)
return tries <= 4 ? TRUE : FALSE;
/* Note the lack of a ':' on the GMR; the X200 doesn't send one */
+ g_assert (response);
p = mm_strip_tag (response->str, "AT+GMR");
if (*p != 'L') {
/* X200 modems have a GMR firmware revision that starts with 'L', and