リビジョン | 13058cb71f03066fb81d1652f3dc3ffa050f3c7b (tree) |
---|---|
日時 | 2017-06-09 02:26:40 |
作者 | Amit Mahajan <amitmahajan@goog...> |
コミッター | Amit Mahajan |
Treat NULL payload in RIL messages as valid where applicable.
Test: basic telephony sanity
Bug: 62262047
Change-Id: Icdd199025b8890e8be66a18d47dff0f991ff4308
@@ -2974,7 +2974,8 @@ int radio::getCurrentCallsResponse(int slotId, | ||
2974 | 2974 | populateResponseInfo(responseInfo, serial, responseType, e); |
2975 | 2975 | |
2976 | 2976 | hidl_vec<Call> calls; |
2977 | - if (response == NULL || (responseLen % sizeof(RIL_Call *)) != 0) { | |
2977 | + if ((response == NULL && responseLen != 0) | |
2978 | + || (responseLen % sizeof(RIL_Call *)) != 0) { | |
2978 | 2979 | RLOGE("getCurrentCallsResponse: Invalid response"); |
2979 | 2980 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
2980 | 2981 | } else { |
@@ -3770,9 +3771,11 @@ int radio::setupDataCallResponse(int slotId, | ||
3770 | 3771 | populateResponseInfo(responseInfo, serial, responseType, e); |
3771 | 3772 | |
3772 | 3773 | SetupDataCallResult result = {}; |
3773 | - if (response == NULL || responseLen != sizeof(RIL_Data_Call_Response_v11)) { | |
3774 | - RLOGE("setupDataCallResponse: Invalid response"); | |
3775 | - if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; | |
3774 | + if (response == NULL || (responseLen % sizeof(RIL_Data_Call_Response_v11)) != 0) { | |
3775 | + if (response != NULL) { | |
3776 | + RLOGE("setupDataCallResponse: Invalid response"); | |
3777 | + if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; | |
3778 | + } | |
3776 | 3779 | result.status = DataCallFailCause::ERROR_UNSPECIFIED; |
3777 | 3780 | result.type = hidl_string(); |
3778 | 3781 | result.ifname = hidl_string(); |
@@ -3938,7 +3941,8 @@ int radio::getCallForwardStatusResponse(int slotId, | ||
3938 | 3941 | populateResponseInfo(responseInfo, serial, responseType, e); |
3939 | 3942 | hidl_vec<CallForwardInfo> callForwardInfos; |
3940 | 3943 | |
3941 | - if (response == NULL || responseLen % sizeof(RIL_CallForwardInfo *) != 0) { | |
3944 | + if ((response == NULL && responseLen != 0) | |
3945 | + || responseLen % sizeof(RIL_CallForwardInfo *) != 0) { | |
3942 | 3946 | RLOGE("getCallForwardStatusResponse Invalid response: NULL"); |
3943 | 3947 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
3944 | 3948 | } else { |
@@ -4266,7 +4270,8 @@ int radio::getAvailableNetworksResponse(int slotId, | ||
4266 | 4270 | RadioResponseInfo responseInfo = {}; |
4267 | 4271 | populateResponseInfo(responseInfo, serial, responseType, e); |
4268 | 4272 | hidl_vec<OperatorInfo> networks; |
4269 | - if (response == NULL || responseLen % (4 * sizeof(char *))!= 0) { | |
4273 | + if ((response == NULL && responseLen != 0) | |
4274 | + || responseLen % (4 * sizeof(char *))!= 0) { | |
4270 | 4275 | RLOGE("getAvailableNetworksResponse Invalid response: NULL"); |
4271 | 4276 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
4272 | 4277 | } else { |
@@ -4460,7 +4465,8 @@ int radio::getDataCallListResponse(int slotId, | ||
4460 | 4465 | populateResponseInfo(responseInfo, serial, responseType, e); |
4461 | 4466 | |
4462 | 4467 | hidl_vec<SetupDataCallResult> ret; |
4463 | - if (response == NULL || responseLen % sizeof(RIL_Data_Call_Response_v11) != 0) { | |
4468 | + if ((response == NULL && responseLen != 0) | |
4469 | + || responseLen % sizeof(RIL_Data_Call_Response_v11) != 0) { | |
4464 | 4470 | RLOGE("getDataCallListResponse: invalid response"); |
4465 | 4471 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
4466 | 4472 | } else { |
@@ -4570,7 +4576,7 @@ int radio::getAvailableBandModesResponse(int slotId, | ||
4570 | 4576 | RadioResponseInfo responseInfo = {}; |
4571 | 4577 | populateResponseInfo(responseInfo, serial, responseType, e); |
4572 | 4578 | hidl_vec<RadioBandMode> modes; |
4573 | - if (response == NULL || responseLen % sizeof(int) != 0) { | |
4579 | + if ((response == NULL && responseLen != 0)|| responseLen % sizeof(int) != 0) { | |
4574 | 4580 | RLOGE("getAvailableBandModesResponse Invalid response: NULL"); |
4575 | 4581 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
4576 | 4582 | } else { |
@@ -4737,7 +4743,8 @@ int radio::getNeighboringCidsResponse(int slotId, | ||
4737 | 4743 | populateResponseInfo(responseInfo, serial, responseType, e); |
4738 | 4744 | hidl_vec<NeighboringCell> cells; |
4739 | 4745 | |
4740 | - if (response == NULL || responseLen % sizeof(RIL_NeighboringCell *) != 0) { | |
4746 | + if ((response == NULL && responseLen != 0) | |
4747 | + || responseLen % sizeof(RIL_NeighboringCell *) != 0) { | |
4741 | 4748 | RLOGE("getNeighboringCidsResponse Invalid response: NULL"); |
4742 | 4749 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
4743 | 4750 | } else { |
@@ -5040,7 +5047,8 @@ int radio::getGsmBroadcastConfigResponse(int slotId, | ||
5040 | 5047 | populateResponseInfo(responseInfo, serial, responseType, e); |
5041 | 5048 | hidl_vec<GsmBroadcastSmsConfigInfo> configs; |
5042 | 5049 | |
5043 | - if (response == NULL || responseLen % sizeof(RIL_GSM_BroadcastSmsConfigInfo *) != 0) { | |
5050 | + if ((response == NULL && responseLen != 0) | |
5051 | + || responseLen % sizeof(RIL_GSM_BroadcastSmsConfigInfo *) != 0) { | |
5044 | 5052 | RLOGE("getGsmBroadcastConfigResponse Invalid response: NULL"); |
5045 | 5053 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
5046 | 5054 | } else { |
@@ -5124,7 +5132,8 @@ int radio::getCdmaBroadcastConfigResponse(int slotId, | ||
5124 | 5132 | populateResponseInfo(responseInfo, serial, responseType, e); |
5125 | 5133 | hidl_vec<CdmaBroadcastSmsConfigInfo> configs; |
5126 | 5134 | |
5127 | - if (response == NULL || responseLen % sizeof(RIL_CDMA_BroadcastSmsConfigInfo *) != 0) { | |
5135 | + if ((response == NULL && responseLen != 0) | |
5136 | + || responseLen % sizeof(RIL_CDMA_BroadcastSmsConfigInfo *) != 0) { | |
5128 | 5137 | RLOGE("getCdmaBroadcastConfigResponse Invalid response: NULL"); |
5129 | 5138 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
5130 | 5139 | } else { |
@@ -5545,7 +5554,8 @@ int radio::getCellInfoListResponse(int slotId, | ||
5545 | 5554 | populateResponseInfo(responseInfo, serial, responseType, e); |
5546 | 5555 | |
5547 | 5556 | hidl_vec<CellInfo> ret; |
5548 | - if (response == NULL || responseLen % sizeof(RIL_CellInfo_v12) != 0) { | |
5557 | + if ((response == NULL && responseLen != 0) | |
5558 | + || responseLen % sizeof(RIL_CellInfo_v12) != 0) { | |
5549 | 5559 | RLOGE("getCellInfoListResponse: Invalid response"); |
5550 | 5560 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
5551 | 5561 | } else { |
@@ -5699,7 +5709,9 @@ int radio::iccOpenLogicalChannelResponse(int slotId, | ||
5699 | 5709 | int numInts = responseLen / sizeof(int); |
5700 | 5710 | if (response == NULL || responseLen % sizeof(int) != 0) { |
5701 | 5711 | RLOGE("iccOpenLogicalChannelResponse Invalid response: NULL"); |
5702 | - if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; | |
5712 | + if (response != NULL) { | |
5713 | + if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; | |
5714 | + } | |
5703 | 5715 | } else { |
5704 | 5716 | int *pInt = (int *) response; |
5705 | 5717 | channelId = pInt[0]; |
@@ -5900,7 +5912,8 @@ int radio::getHardwareConfigResponse(int slotId, | ||
5900 | 5912 | populateResponseInfo(responseInfo, serial, responseType, e); |
5901 | 5913 | |
5902 | 5914 | hidl_vec<HardwareConfig> result; |
5903 | - if (response == NULL || responseLen % sizeof(RIL_HardwareConfig) != 0) { | |
5915 | + if ((response == NULL && responseLen != 0) | |
5916 | + || responseLen % sizeof(RIL_HardwareConfig) != 0) { | |
5904 | 5917 | RLOGE("hardwareConfigChangedInd: invalid response"); |
5905 | 5918 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
5906 | 5919 | } else { |
@@ -6350,7 +6363,7 @@ int radio::sendRequestStringsResponse(int slotId, | ||
6350 | 6363 | populateResponseInfo(responseInfo, serial, responseType, e); |
6351 | 6364 | hidl_vec<hidl_string> data; |
6352 | 6365 | |
6353 | - if (response == NULL || responseLen % sizeof(char *) != 0) { | |
6366 | + if ((response == NULL && responseLen != 0) || responseLen % sizeof(char *) != 0) { | |
6354 | 6367 | RLOGE("sendRequestStringsResponse Invalid response: NULL"); |
6355 | 6368 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
6356 | 6369 | } else { |
@@ -6698,7 +6711,8 @@ int radio::dataCallListChangedInd(int slotId, | ||
6698 | 6711 | int indicationType, int token, RIL_Errno e, void *response, |
6699 | 6712 | size_t responseLen) { |
6700 | 6713 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
6701 | - if (response == NULL || responseLen % sizeof(RIL_Data_Call_Response_v11) != 0) { | |
6714 | + if ((response == NULL && responseLen != 0) | |
6715 | + || responseLen % sizeof(RIL_Data_Call_Response_v11) != 0) { | |
6702 | 6716 | RLOGE("dataCallListChangedInd: invalid response"); |
6703 | 6717 | return 0; |
6704 | 6718 | } |
@@ -7581,7 +7595,7 @@ int radio::cellInfoListInd(int slotId, | ||
7581 | 7595 | int indicationType, int token, RIL_Errno e, void *response, |
7582 | 7596 | size_t responseLen) { |
7583 | 7597 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
7584 | - if (response == NULL || responseLen % sizeof(RIL_CellInfo_v12) != 0) { | |
7598 | + if ((response == NULL && responseLen != 0) || responseLen % sizeof(RIL_CellInfo_v12) != 0) { | |
7585 | 7599 | RLOGE("cellInfoListInd: invalid response"); |
7586 | 7600 | return 0; |
7587 | 7601 | } |
@@ -7702,7 +7716,8 @@ int radio::hardwareConfigChangedInd(int slotId, | ||
7702 | 7716 | int indicationType, int token, RIL_Errno e, void *response, |
7703 | 7717 | size_t responseLen) { |
7704 | 7718 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
7705 | - if (response == NULL || responseLen % sizeof(RIL_HardwareConfig) != 0) { | |
7719 | + if ((response == NULL && responseLen != 0) | |
7720 | + || responseLen % sizeof(RIL_HardwareConfig) != 0) { | |
7706 | 7721 | RLOGE("hardwareConfigChangedInd: invalid response"); |
7707 | 7722 | return 0; |
7708 | 7723 | } |