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

Commit 5915fa32 authored by Kevin Rocard's avatar Kevin Rocard
Browse files

libaudiohal: Fix dereference before NULL check



deviceAddressFromHal was checking the wrong pointer before dereferencing.

Test: compile
Bug: 77263416
Change-Id: Ic47af7085dd88f451ae81034b84444719f68cfc5
Signed-off-by: default avatarKevin Rocard <krocard@google.com>
parent 0c2e7237
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ status_t deviceAddressFromHal(
        audio_devices_t device, const char* halAddress, DeviceAddress* address) {
    address->device = AudioDevice(device);

    if (address == nullptr || strnlen(halAddress, AUDIO_DEVICE_MAX_ADDRESS_LEN) == 0) {
    if (halAddress == nullptr || strnlen(halAddress, AUDIO_DEVICE_MAX_ADDRESS_LEN) == 0) {
        return OK;
    }
    const bool isInput = (device & AUDIO_DEVICE_BIT_IN) != 0;
+1 −1
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ status_t deviceAddressFromHal(
        audio_devices_t device, const char* halAddress, DeviceAddress* address) {
    address->device = AudioDevice(device);

    if (address == nullptr || strnlen(halAddress, AUDIO_DEVICE_MAX_ADDRESS_LEN) == 0) {
    if (halAddress == nullptr || strnlen(halAddress, AUDIO_DEVICE_MAX_ADDRESS_LEN) == 0) {
        return OK;
    }
    const bool isInput = (device & AUDIO_DEVICE_BIT_IN) != 0;