diff options
author | Amit Mahajan <amitmahajan@google.com> | 2017-06-09 07:27:29 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-06-09 07:27:29 +0000 |
commit | 6fe9ed5215a7ea58866350ff1ea52f52768fea4e (patch) | |
tree | b3ce2a223046e17bce5b2ddd6766b401ef4455ee | |
parent | aacc2e78d85f50af8256d16455a21dc2221ce0a2 (diff) | |
parent | 65d3486b2fd5dcff52dae8697ec471ab1ad577b8 (diff) | |
download | android_hardware_ril-6fe9ed5215a7ea58866350ff1ea52f52768fea4e.tar.gz android_hardware_ril-6fe9ed5215a7ea58866350ff1ea52f52768fea4e.tar.bz2 android_hardware_ril-6fe9ed5215a7ea58866350ff1ea52f52768fea4e.zip |
Merge "Treat NULL payload in RIL messages as valid where applicable." into oc-dev
am: 65d3486b2f
Change-Id: I604a461ba6d9d43730405ba5617afb6dcb871b39
-rw-r--r-- | libril/ril_service.cpp | 51 |
1 files changed, 33 insertions, 18 deletions
diff --git a/libril/ril_service.cpp b/libril/ril_service.cpp index 37c96dc..ab22d4c 100644 --- a/libril/ril_service.cpp +++ b/libril/ril_service.cpp @@ -3073,7 +3073,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 { @@ -3909,9 +3910,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(); @@ -4077,7 +4080,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 { @@ -4404,7 +4408,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 { @@ -4597,7 +4602,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 { @@ -4707,7 +4713,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 { @@ -4874,7 +4880,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 { @@ -5177,7 +5184,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 { @@ -5261,7 +5269,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 { @@ -5682,7 +5691,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 { @@ -5836,7 +5846,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]; @@ -6037,7 +6049,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 { @@ -6576,7 +6589,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 { @@ -6924,7 +6937,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; } @@ -7807,7 +7821,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; } @@ -7928,7 +7942,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; } |