stk: fix issue to avoid null pointer for alpha_id
authorGuillaume Lucas <guillaumex.lucas@intel.com>
Wed, 8 Dec 2010 12:33:32 +0000 (12:33 +0000)
committerDenis Kenzior <denkenz@gmail.com>
Fri, 10 Dec 2010 17:18:06 +0000 (11:18 -0600)
If a SET UP CALL proactive command with no alpha identifier
occurs, the alpha_id pointer will be set to NULL. This will
generate a crash in the stkagent with dbus function. To avoid
this we use an empty string if the alpha identifier is not
present in the command.

src/stk.c

index 09229ce..87208d1 100644 (file)
--- a/src/stk.c
+++ b/src/stk.c
@@ -1753,13 +1753,12 @@ static gboolean handle_command_set_up_call(const struct stk_command *cmd,
                return TRUE;
        }
 
-       if (sc->alpha_id_usr_cfm) {
-               alpha_id = dbus_apply_text_attributes(sc->alpha_id_usr_cfm,
-                                                       &sc->text_attr_usr_cfm);
-               if (alpha_id == NULL) {
-                       rsp->result.type = STK_RESULT_TYPE_DATA_NOT_UNDERSTOOD;
-                       return TRUE;
-               }
+       alpha_id = dbus_apply_text_attributes(sc->alpha_id_usr_cfm ?
+                                               sc->alpha_id_usr_cfm : "",
+                                               &sc->text_attr_usr_cfm);
+       if (alpha_id == NULL) {
+               rsp->result.type = STK_RESULT_TYPE_DATA_NOT_UNDERSTOOD;
+               return TRUE;
        }
 
        err = stk_agent_confirm_call(stk->current_agent, alpha_id,