Fix ERROR.indication unpack function
Fix an issue in which the unpacking is erroneously deemed unsuccessful even though it succeed in pulling all the bytes, this was due to not properly handling the return value of pull16 which is either 0 or 2, not 0 or 1. Check the results of push and pull operation with correct boolean operator.
This commit is contained in:
@@ -1866,22 +1866,23 @@ uint8_t unpack_nr_stop_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void
|
||||
uint8_t pack_nr_error_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config)
|
||||
{
|
||||
nfapi_nr_error_indication_scf_t *pNfapiMsg = (nfapi_nr_error_indication_scf_t *)msg;
|
||||
uint8_t retval = push16(pNfapiMsg->sfn, ppWritePackedMsg, end) != 0;
|
||||
retval &= push16(pNfapiMsg->slot, ppWritePackedMsg, end) != 0;
|
||||
retval &= push8(pNfapiMsg->message_id, ppWritePackedMsg, end);
|
||||
retval &= push8(pNfapiMsg->error_code, ppWritePackedMsg, end);
|
||||
|
||||
retval &= pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
|
||||
return retval;
|
||||
if (push16(pNfapiMsg->sfn, ppWritePackedMsg, end) && push16(pNfapiMsg->slot, ppWritePackedMsg, end)
|
||||
&& push8(pNfapiMsg->message_id, ppWritePackedMsg, end) && push8(pNfapiMsg->error_code, ppWritePackedMsg, end)
|
||||
&& pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t unpack_nr_error_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config)
|
||||
{
|
||||
nfapi_nr_error_indication_scf_t *pNfapiMsg = (nfapi_nr_error_indication_scf_t *)msg;
|
||||
uint8_t retval = pull16(ppReadPackedMsg, &pNfapiMsg->sfn, end);
|
||||
retval &= pull16(ppReadPackedMsg, &pNfapiMsg->slot, end);
|
||||
retval &= pull8(ppReadPackedMsg, &pNfapiMsg->message_id, end);
|
||||
retval &= pull8(ppReadPackedMsg, &pNfapiMsg->error_code, end);
|
||||
retval &= unpack_nr_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension));
|
||||
return retval;
|
||||
if (pull16(ppReadPackedMsg, &pNfapiMsg->sfn, end) && pull16(ppReadPackedMsg, &pNfapiMsg->slot, end)
|
||||
&& pull8(ppReadPackedMsg, &pNfapiMsg->message_id, end) && pull8(ppReadPackedMsg, &pNfapiMsg->error_code, end)
|
||||
&& unpack_nr_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension))) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user