Skip to contentSkip to conversation

Return error when modem_obj_path is NULL

PATCH In review Forrest Zhao 2 participants 2 messages Mar 29, 2010 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Return error when modem_obj_path is NULL

This could prevent crash in case modem_obj_path is NULL.

---
 audio/telephony-ofono.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
audio/telephony-ofono.c +15 -0
index 45c3905..30f8b27 100644
@@ -281,6 +281,12 @@ void telephony_dial_number_req(void *telephony_device, const char *number)
 
 	debug("telephony-ofono: dial request to %s", number);
 
+	if (!modem_obj_path) {
+		telephony_dial_number_rsp(telephony_device,
+					CME_ERROR_AG_FAILURE);
+		return;
+	}
+
 	if (!strncmp(number, "*31#", 4)) {
 		number += 4;
 		clir = "enabled";
@@ -311,6 +317,12 @@ void telephony_transmit_dtmf_req(void *telephony_device, char tone)
 
 	debug("telephony-ofono: transmit dtmf: %c", tone);
 
+	if (!modem_obj_path) {
+		telephony_transmit_dtmf_rsp(telephony_device,
+					CME_ERROR_AG_FAILURE);
+		return;
+	}
+
 	tone_string = g_strdup_printf("%c", tone);
 	ret = send_method_call(OFONO_BUS_NAME, modem_obj_path,
 			OFONO_VCMANAGER_INTERFACE,
@@ -531,6 +543,9 @@ done:
 
 static int get_registration_and_signal_status()
 {
+	if (!modem_obj_path)
+		return -ENOENT;
+
 	return send_method_call(OFONO_BUS_NAME, modem_obj_path,
 			OFONO_NETWORKREG_INTERFACE,
 			"GetProperties", get_registration_reply,
Signature · 1 line
1.6.1.3
#1 lore raw

Hi Forrest,

Quoted 4 lines · Forrest Zhao

This could prevent crash in case modem_obj_path is NULL.

---
 audio/telephony-ofono.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

Thanks. Pushed upstream.

Johan