[rcp] fix DecodeStreamRawTxRequest() to handle missing optional fields (#8844)

This commit updates `DecodeStreamRawTxRequest()` to set the read
boolean flags immediately after they are decoded (not wait till
all fields are read). This ensures correct processing of optional
fields.
This commit is contained in:
Abtin Keshavarzian
2023-03-07 18:17:37 -08:00
committed by GitHub
parent a94fc44425
commit 3a688cb9cc
+9 -4
View File
@@ -425,17 +425,22 @@ otError NcpBase::DecodeStreamRawTxRequest(otRadioFrame &aFrame)
SuccessOrExit(mDecoder.ReadUint8(aFrame.mInfo.mTxInfo.mMaxCsmaBackoffs));
SuccessOrExit(mDecoder.ReadUint8(aFrame.mInfo.mTxInfo.mMaxFrameRetries));
SuccessOrExit(mDecoder.ReadBool(csmaEnable));
aFrame.mInfo.mTxInfo.mCsmaCaEnabled = csmaEnable;
SuccessOrExit(mDecoder.ReadBool(isHeaderUpdated));
aFrame.mInfo.mTxInfo.mIsHeaderUpdated = isHeaderUpdated;
SuccessOrExit(mDecoder.ReadBool(isARetx));
aFrame.mInfo.mTxInfo.mIsARetx = isARetx;
SuccessOrExit(mDecoder.ReadBool(isSecurityProcessed));
aFrame.mInfo.mTxInfo.mIsSecurityProcessed = isSecurityProcessed;
SuccessOrExit(mDecoder.ReadUint32(aFrame.mInfo.mTxInfo.mTxDelay));
SuccessOrExit(mDecoder.ReadUint32(aFrame.mInfo.mTxInfo.mTxDelayBaseTime));
SuccessOrExit(mDecoder.ReadUint8(aFrame.mInfo.mTxInfo.mRxChannelAfterTxDone));
aFrame.mInfo.mTxInfo.mCsmaCaEnabled = csmaEnable;
aFrame.mInfo.mTxInfo.mIsHeaderUpdated = isHeaderUpdated;
aFrame.mInfo.mTxInfo.mIsARetx = isARetx;
aFrame.mInfo.mTxInfo.mIsSecurityProcessed = isSecurityProcessed;
exit:
return error;