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

Commit e81c762f authored by Greg Kaiser's avatar Greg Kaiser
Browse files

Avoid potential null dereference

Since our logic thinks 'replySize' could possibly be null, we
check the value prior to logging it.

Test: TreeHugger
Change-Id: I52e802157df2a28748f08f58ad492f8afd8dbfee
parent 1b400288
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -420,7 +420,8 @@ int32_t HapticGenerator_Command(effect_handle_t self, uint32_t cmdCode, uint32_t

        case EFFECT_CMD_SET_PARAM: {
            ALOGV("HapticGenerator_Command EFFECT_CMD_SET_PARAM cmdSize %d cmdData %p, "
                  "*replySize %u, replyData %p", cmdSize, cmdData, *replySize, replyData);
                  "*replySize %u, replyData %p", cmdSize, cmdData,
                  replySize ? *replySize : 0, replyData);
            if (cmdData == nullptr || (cmdSize < (int) (sizeof(effect_param_t) + sizeof(int32_t)))
                || replyData == nullptr || replySize == nullptr ||
                *replySize != (int) sizeof(int32_t)) {