Unverified Commit b35f6082 authored by Stricted's avatar Stricted

libril: ensure no null pointers are passed to libsec-ril in RadioImpl::setInitialAttachApn

Change-Id: Ifdd8eb45dea17eb2a4c5b3a0377d7b7492a888f3
Signed-off-by: 's avatarStricted <info@stricted.net>
parent 709556c2
......@@ -1952,6 +1952,29 @@ Return<void> RadioImpl::setInitialAttachApn(int32_t serial, const DataProfileInf
iaa.imsType = 0;
#endif
static hidl_string HIDL_EMPTY = hidl_string("");
if (iaa.apn == NULL && !copyHidlStringToRil(
&iaa.apn, HIDL_EMPTY, pRI)) {
return Void();
}
if (iaa.protocol == NULL && !copyHidlStringToRil(
&iaa.protocol, HIDL_EMPTY, pRI)) {
memsetAndFreeStrings(1, iaa.apn);
return Void();
}
if (iaa.username == NULL && !copyHidlStringToRil(
&iaa.username, HIDL_EMPTY, pRI)) {
memsetAndFreeStrings(2, iaa.apn, iaa.protocol);
return Void();
}
if (iaa.password == NULL && !copyHidlStringToRil(
&iaa.password, HIDL_EMPTY, pRI)) {
memsetAndFreeStrings(3, iaa.apn, iaa.protocol, iaa.username);
return Void();
}
CALL_ONREQUEST(RIL_REQUEST_SET_INITIAL_ATTACH_APN, &iaa, sizeof(iaa), pRI, mSlotId);
#ifdef NEEDS_ROAMING_PROTOCOL_FIELD
......@@ -2013,6 +2036,39 @@ Return<void> RadioImpl::setInitialAttachApn(int32_t serial, const DataProfileInf
return Void();
}
static hidl_string HIDL_EMPTY = hidl_string("");
if (iaa.apn == NULL && !copyHidlStringToRil(
&iaa.apn, HIDL_EMPTY, pRI)) {
return Void();
}
if (iaa.protocol == NULL && !copyHidlStringToRil(
&iaa.protocol, HIDL_EMPTY, pRI)) {
memsetAndFreeStrings(1, iaa.apn);
return Void();
}
if (iaa.roamingProtocol == NULL && !copyHidlStringToRil(
&iaa.roamingProtocol, HIDL_EMPTY, pRI)) {
memsetAndFreeStrings(2, iaa.apn, iaa.protocol);
return Void();
}
if (iaa.username == NULL && !copyHidlStringToRil(
&iaa.username, HIDL_EMPTY, pRI)) {
memsetAndFreeStrings(3, iaa.apn, iaa.protocol, iaa.roamingProtocol);
return Void();
}
if (iaa.password == NULL && !copyHidlStringToRil(
&iaa.password, HIDL_EMPTY, pRI)) {
memsetAndFreeStrings(4, iaa.apn, iaa.protocol, iaa.roamingProtocol, iaa.username);
return Void();
}
if (iaa.mvnoMatchData == NULL && !copyHidlStringToRil(
&iaa.mvnoMatchData, HIDL_EMPTY, pRI)) {
memsetAndFreeStrings(5, iaa.apn, iaa.protocol, iaa.roamingProtocol, iaa.username,
iaa.password);
return Void();
}
CALL_ONREQUEST(RIL_REQUEST_SET_INITIAL_ATTACH_APN, &iaa, sizeof(iaa), pRI, mSlotId);
memsetAndFreeStrings(6, iaa.apn, iaa.protocol, iaa.roamingProtocol, iaa.username,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment