summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmit Mahajan <amitmahajan@google.com>2017-06-07 23:10:27 -0700
committerAmit Mahajan <amitmahajan@google.com>2017-06-08 10:26:40 -0700
commit13058cb71f03066fb81d1652f3dc3ffa050f3c7b (patch)
tree0675f8fba8f0768329a985120f45b782e738e078
parent75e42a55efe9bd706b5c2876e4f91fa251e5bcd5 (diff)
downloadandroid_hardware_ril-13058cb71f03066fb81d1652f3dc3ffa050f3c7b.tar.gz
android_hardware_ril-13058cb71f03066fb81d1652f3dc3ffa050f3c7b.tar.bz2
android_hardware_ril-13058cb71f03066fb81d1652f3dc3ffa050f3c7b.zip
Treat NULL payload in RIL messages as valid where applicable.
Test: basic telephony sanity Bug: 62262047 Change-Id: Icdd199025b8890e8be66a18d47dff0f991ff4308
-rw-r--r--libril/ril_service.cpp51
1 files changed, 33 insertions, 18 deletions
diff --git a/libril/ril_service.cpp b/libril/ril_service.cpp
index 43c3b1d..5dc918c 100644
--- a/libril/ril_service.cpp
+++ b/libril/ril_service.cpp
@@ -2974,7 +2974,8 @@ int radio::getCurrentCallsResponse(int slotId,
populateResponseInfo(responseInfo, serial, responseType, e);
hidl_vec<Call> calls;
- if (response == NULL || (responseLen % sizeof(RIL_Call *)) != 0) {
+ if ((response == NULL && responseLen != 0)
+ || (responseLen % sizeof(RIL_Call *)) != 0) {
RLOGE("getCurrentCallsResponse: Invalid response");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
} else {
@@ -3770,9 +3771,11 @@ int radio::setupDataCallResponse(int slotId,
populateResponseInfo(responseInfo, serial, responseType, e);
SetupDataCallResult result = {};
- if (response == NULL || responseLen != sizeof(RIL_Data_Call_Response_v11)) {
- RLOGE("setupDataCallResponse: Invalid response");
- if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
+ if (response == NULL || (responseLen % sizeof(RIL_Data_Call_Response_v11)) != 0) {
+ if (response != NULL) {
+ RLOGE("setupDataCallResponse: Invalid response");
+ if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
+ }
result.status = DataCallFailCause::ERROR_UNSPECIFIED;
result.type = hidl_string();
result.ifname = hidl_string();
@@ -3938,7 +3941,8 @@ int radio::getCallForwardStatusResponse(int slotId,
populateResponseInfo(responseInfo, serial, responseType, e);
hidl_vec<CallForwardInfo> callForwardInfos;
- if (response == NULL || responseLen % sizeof(RIL_CallForwardInfo *) != 0) {
+ if ((response == NULL && responseLen != 0)
+ || responseLen % sizeof(RIL_CallForwardInfo *) != 0) {
RLOGE("getCallForwardStatusResponse Invalid response: NULL");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
} else {
@@ -4266,7 +4270,8 @@ int radio::getAvailableNetworksResponse(int slotId,
RadioResponseInfo responseInfo = {};
populateResponseInfo(responseInfo, serial, responseType, e);
hidl_vec<OperatorInfo> networks;
- if (response == NULL || responseLen % (4 * sizeof(char *))!= 0) {
+ if ((response == NULL && responseLen != 0)
+ || responseLen % (4 * sizeof(char *))!= 0) {
RLOGE("getAvailableNetworksResponse Invalid response: NULL");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
} else {
@@ -4460,7 +4465,8 @@ int radio::getDataCallListResponse(int slotId,
populateResponseInfo(responseInfo, serial, responseType, e);
hidl_vec<SetupDataCallResult> ret;
- if (response == NULL || responseLen % sizeof(RIL_Data_Call_Response_v11) != 0) {
+ if ((response == NULL && responseLen != 0)
+ || responseLen % sizeof(RIL_Data_Call_Response_v11) != 0) {
RLOGE("getDataCallListResponse: invalid response");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
} else {
@@ -4570,7 +4576,7 @@ int radio::getAvailableBandModesResponse(int slotId,
RadioResponseInfo responseInfo = {};
populateResponseInfo(responseInfo, serial, responseType, e);
hidl_vec<RadioBandMode> modes;
- if (response == NULL || responseLen % sizeof(int) != 0) {
+ if ((response == NULL && responseLen != 0)|| responseLen % sizeof(int) != 0) {
RLOGE("getAvailableBandModesResponse Invalid response: NULL");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
} else {
@@ -4737,7 +4743,8 @@ int radio::getNeighboringCidsResponse(int slotId,
populateResponseInfo(responseInfo, serial, responseType, e);
hidl_vec<NeighboringCell> cells;
- if (response == NULL || responseLen % sizeof(RIL_NeighboringCell *) != 0) {
+ if ((response == NULL && responseLen != 0)
+ || responseLen % sizeof(RIL_NeighboringCell *) != 0) {
RLOGE("getNeighboringCidsResponse Invalid response: NULL");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
} else {
@@ -5040,7 +5047,8 @@ int radio::getGsmBroadcastConfigResponse(int slotId,
populateResponseInfo(responseInfo, serial, responseType, e);
hidl_vec<GsmBroadcastSmsConfigInfo> configs;
- if (response == NULL || responseLen % sizeof(RIL_GSM_BroadcastSmsConfigInfo *) != 0) {
+ if ((response == NULL && responseLen != 0)
+ || responseLen % sizeof(RIL_GSM_BroadcastSmsConfigInfo *) != 0) {
RLOGE("getGsmBroadcastConfigResponse Invalid response: NULL");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
} else {
@@ -5124,7 +5132,8 @@ int radio::getCdmaBroadcastConfigResponse(int slotId,
populateResponseInfo(responseInfo, serial, responseType, e);
hidl_vec<CdmaBroadcastSmsConfigInfo> configs;
- if (response == NULL || responseLen % sizeof(RIL_CDMA_BroadcastSmsConfigInfo *) != 0) {
+ if ((response == NULL && responseLen != 0)
+ || responseLen % sizeof(RIL_CDMA_BroadcastSmsConfigInfo *) != 0) {
RLOGE("getCdmaBroadcastConfigResponse Invalid response: NULL");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
} else {
@@ -5545,7 +5554,8 @@ int radio::getCellInfoListResponse(int slotId,
populateResponseInfo(responseInfo, serial, responseType, e);
hidl_vec<CellInfo> ret;
- if (response == NULL || responseLen % sizeof(RIL_CellInfo_v12) != 0) {
+ if ((response == NULL && responseLen != 0)
+ || responseLen % sizeof(RIL_CellInfo_v12) != 0) {
RLOGE("getCellInfoListResponse: Invalid response");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
} else {
@@ -5699,7 +5709,9 @@ int radio::iccOpenLogicalChannelResponse(int slotId,
int numInts = responseLen / sizeof(int);
if (response == NULL || responseLen % sizeof(int) != 0) {
RLOGE("iccOpenLogicalChannelResponse Invalid response: NULL");
- if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
+ if (response != NULL) {
+ if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
+ }
} else {
int *pInt = (int *) response;
channelId = pInt[0];
@@ -5900,7 +5912,8 @@ int radio::getHardwareConfigResponse(int slotId,
populateResponseInfo(responseInfo, serial, responseType, e);
hidl_vec<HardwareConfig> result;
- if (response == NULL || responseLen % sizeof(RIL_HardwareConfig) != 0) {
+ if ((response == NULL && responseLen != 0)
+ || responseLen % sizeof(RIL_HardwareConfig) != 0) {
RLOGE("hardwareConfigChangedInd: invalid response");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
} else {
@@ -6350,7 +6363,7 @@ int radio::sendRequestStringsResponse(int slotId,
populateResponseInfo(responseInfo, serial, responseType, e);
hidl_vec<hidl_string> data;
- if (response == NULL || responseLen % sizeof(char *) != 0) {
+ if ((response == NULL && responseLen != 0) || responseLen % sizeof(char *) != 0) {
RLOGE("sendRequestStringsResponse Invalid response: NULL");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
} else {
@@ -6698,7 +6711,8 @@ int radio::dataCallListChangedInd(int slotId,
int indicationType, int token, RIL_Errno e, void *response,
size_t responseLen) {
if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
- if (response == NULL || responseLen % sizeof(RIL_Data_Call_Response_v11) != 0) {
+ if ((response == NULL && responseLen != 0)
+ || responseLen % sizeof(RIL_Data_Call_Response_v11) != 0) {
RLOGE("dataCallListChangedInd: invalid response");
return 0;
}
@@ -7581,7 +7595,7 @@ int radio::cellInfoListInd(int slotId,
int indicationType, int token, RIL_Errno e, void *response,
size_t responseLen) {
if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
- if (response == NULL || responseLen % sizeof(RIL_CellInfo_v12) != 0) {
+ if ((response == NULL && responseLen != 0) || responseLen % sizeof(RIL_CellInfo_v12) != 0) {
RLOGE("cellInfoListInd: invalid response");
return 0;
}
@@ -7702,7 +7716,8 @@ int radio::hardwareConfigChangedInd(int slotId,
int indicationType, int token, RIL_Errno e, void *response,
size_t responseLen) {
if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
- if (response == NULL || responseLen % sizeof(RIL_HardwareConfig) != 0) {
+ if ((response == NULL && responseLen != 0)
+ || responseLen % sizeof(RIL_HardwareConfig) != 0) {
RLOGE("hardwareConfigChangedInd: invalid response");
return 0;
}