diff options
author | Ben Chan <benchan@chromium.org> | 2012-11-26 23:56:27 -0800 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-11-27 11:00:35 +0100 |
commit | 674ecaa6eb356539a56d84057cc9fa7b5aeed0b1 (patch) | |
tree | f7c2b51b00390965d4b83f55c4e31f22b08ac014 | |
parent | cf46ed42384e9fbd4872e2f98d743755d8f9a571 (diff) |
broadband-modem: check for NULL response in parse_caps_{cpin,cgmm,gcap}
-rw-r--r-- | src/mm-broadband-modem.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c index 9161c82c..174de9d1 100644 --- a/src/mm-broadband-modem.c +++ b/src/mm-broadband-modem.c | |||
@@ -435,10 +435,13 @@ parse_caps_gcap (MMBaseModem *self, | |||
435 | const ModemCaps *cap = modem_caps; | 435 | const ModemCaps *cap = modem_caps; |
436 | guint32 ret = 0; | 436 | guint32 ret = 0; |
437 | 437 | ||
438 | if (!response) | ||
439 | return FALSE; | ||
440 | |||
438 | /* Some modems (Huawei E160g) won't respond to +GCAP with no SIM, but | 441 | /* Some modems (Huawei E160g) won't respond to +GCAP with no SIM, but |
439 | * will respond to ATI. Ignore the error and continue. | 442 | * will respond to ATI. Ignore the error and continue. |
440 | */ | 443 | */ |
441 | if (response && strstr (response, "+CME ERROR:")) | 444 | if (strstr (response, "+CME ERROR:")) |
442 | return FALSE; | 445 | return FALSE; |
443 | 446 | ||
444 | while (cap->name) { | 447 | while (cap->name) { |
@@ -465,6 +468,9 @@ parse_caps_cpin (MMBaseModem *self, | |||
465 | GVariant **result, | 468 | GVariant **result, |
466 | GError **result_error) | 469 | GError **result_error) |
467 | { | 470 | { |
471 | if (!response) | ||
472 | return FALSE; | ||
473 | |||
468 | if (strcasestr (response, "SIM PIN") || | 474 | if (strcasestr (response, "SIM PIN") || |
469 | strcasestr (response, "SIM PUK") || | 475 | strcasestr (response, "SIM PUK") || |
470 | strcasestr (response, "PH-SIM PIN") || | 476 | strcasestr (response, "PH-SIM PIN") || |
@@ -498,6 +504,9 @@ parse_caps_cgmm (MMBaseModem *self, | |||
498 | GVariant **result, | 504 | GVariant **result, |
499 | GError **result_error) | 505 | GError **result_error) |
500 | { | 506 | { |
507 | if (!response) | ||
508 | return FALSE; | ||
509 | |||
501 | /* This check detects some really old Motorola GPRS dongles and phones */ | 510 | /* This check detects some really old Motorola GPRS dongles and phones */ |
502 | if (strstr (response, "GSM900") || | 511 | if (strstr (response, "GSM900") || |
503 | strstr (response, "GSM1800") || | 512 | strstr (response, "GSM1800") || |