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

Verified Commit 709556c2 authored by Lukas0610's avatar Lukas0610 Committed by Jan Altensen
Browse files

libril: ensure no NULL-ptrs are passed for user/pass in setDataProfile

Change-Id: Ief1ad87e47a7a2d56dbed80484c009d2ad7f1a2a
parent 28ad515f
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -2413,6 +2413,19 @@ Return<void> RadioImpl::setDataProfile(int32_t serial, const hidl_vec<DataProfil
                success = false;
            }

            // FIXUP: at least the libsec-ril on zero can't handle user and password
            // being passed as NULL-pointers. Copy an empty string into it to work around
            static hidl_string HIDL_EMPTY = hidl_string("");

            if (success && dataProfiles[i].user == NULL && !copyHidlStringToRil(
                    &dataProfiles[i].user, HIDL_EMPTY, pRI)) {
                success = false;
            }
            if (success && dataProfiles[i].password == NULL && !copyHidlStringToRil(
                    &dataProfiles[i].password, HIDL_EMPTY, pRI)) {
                success = false;
            }

            if (!success) {
                freeSetDataProfileData(num, dataProfiles, dataProfilePtrs, 4,
                    &RIL_DataProfileInfo::apn, &RIL_DataProfileInfo::protocol,
@@ -2487,6 +2500,19 @@ Return<void> RadioImpl::setDataProfile(int32_t serial, const hidl_vec<DataProfil
                success = false;
            }

            // FIXUP: at least the libsec-ril on zero can't handle user and password
            // being passed as NULL-pointers. Copy an empty string into it to work around
            static hidl_string HIDL_EMPTY = hidl_string("");

            if (success && dataProfiles[i].user == NULL && !copyHidlStringToRil(
                    &dataProfiles[i].user, HIDL_EMPTY, pRI)) {
                success = false;
            }
            if (success && dataProfiles[i].password == NULL && !copyHidlStringToRil(
                    &dataProfiles[i].password, HIDL_EMPTY, pRI)) {
                success = false;
            }

            if (!success) {
                freeSetDataProfileData(num, dataProfiles, dataProfilePtrs, 6,
                    &RIL_DataProfileInfo_v15::apn, &RIL_DataProfileInfo_v15::protocol,