Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 903ed75f authored by Mingshu Pang's avatar Mingshu Pang Committed by Gerrit - the friendly Code Review server
Browse files

hal: Avoid null pointer exceptions

Fix the passing null pointer kv_pairs
to strlen function.

CRs-Fixed: 2504326
Change-Id: Ia7ba1b9f2a8242dd4e591582e6a176a9008d7287
parent 274c95af
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -573,6 +573,11 @@ int32_t ext_hw_plugin_set_parameters(void *plugin, struct str_parms *parms)
    if(val == AUDIO_HAL_PLUGIN_MSG_CODEC_TUNNEL_CMD ||
        val == AUDIO_HAL_PLUGIN_MSG_CODEC_SET_PP_EQ) {
        kv_pairs = str_parms_to_str(parms);
        if (kv_pairs == NULL) {
            ret = -EINVAL;
            ALOGE("%s: key-value pair is NULL", __func__);
            goto done;
        }
        len = strlen(kv_pairs);
        value = (char*)calloc(len, sizeof(char));
        if (value == NULL) {
@@ -1022,6 +1027,11 @@ int ext_hw_plugin_get_parameters(void *plugin,

    if(val == AUDIO_HAL_PLUGIN_MSG_CODEC_TUNNEL_GET_CMD) {
        kv_pairs = str_parms_to_str(query);
        if (kv_pairs == NULL) {
            ret = -EINVAL;
            ALOGE("%s: key-value pair is NULL", __func__);
            goto done_get_param;
        }
        len = strlen(kv_pairs);
        value = (char*)calloc(len, sizeof(char));
        if (value == NULL) {