Check modem_obj_path is not NULL
Hi Forrest,
Quoted 21 lines · Forrest Zhao
This could prevent crash in case
modem_obj_pathis NULL.--- audio/telephony-ofono.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)audio/telephony-ofono.c +4
-0@@ -281,6 +281,10 @@ 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 ); +if (!strncmp (number,"*31#" ,4 )) { number +=4 ; clir ="enabled" ;
audio/telephony-ofono.c void telephony_transmit_dtmf_req(void *telephony_device, char tone) · line 323
Quoted 9 lines
audio/telephony-ofono.c +4
-0@@ -311,6 +315,10 @@ 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 ); + tone_string =g_strdup_printf ("%c" , tone); ret = send_method_call(OFONO_BUS_NAME, modem_obj_path,
This doesn't look right. You report an error but still proceed in the functions (which will later try to access modem_obj_path). I guess you should return from the functions in both of these if-clauses.
Johan
Quoted 4 lines
Quoted 4 lines
audio/telephony-ofono.c +0
-0@@ -311,6 +315,10 @@ void telephony_transmit_dtmf_req(void *telephony_device, char tone) debug("telephony-ofono: transmit dtmf: %c", tone);
Quoted 11 lines
audio/telephony-ofono.c void telephony_transmit_dtmf_req(void *telephony_device, char tone) · line 323
Quoted 6 lines
audio/telephony-ofono.c +4
-0+ if (!modem_obj_path) + telephony_transmit_dtmf_rsp(telephony_device, + CME_ERROR_AG_FAILURE); + tone_string = g_strdup_printf("%c", tone); ret = send_method_call(OFONO_BUS_NAME, modem_obj_path,This doesn't look right. You report an error but still proceed in the functions (which will later try to access
modem_obj_path). I guess you should return from the functions in both of these if-clauses.
My bad. Will send out the updated patch ASAP.
PATCH 1/1 Check modem_obj_path is not NULL
This could prevent crash in case modem_obj_path is NULL.
--- audio/telephony-ofono.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)
audio/telephony-ofono.c +11 -0
@@ -281,6 +281,10 @@ 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 ); +if (!strncmp (number,"*31#" ,4 )) { number +=4 ; clir ="enabled" ;
@@ -311,6 +315,10 @@ 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 ); + tone_string =g_strdup_printf ("%c" , tone); ret = send_method_call(OFONO_BUS_NAME, modem_obj_path, OFONO_VCMANAGER_INTERFACE,
@@ -531,6 +539,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