prevent RxBuffer from overflowing (#843)

This commit is contained in:
Buke Po
2016-10-19 12:59:01 +08:00
committed by Jonathan Hui
parent 85db896df9
commit 87f9cb036e
+6 -2
View File
@@ -117,8 +117,12 @@ void Uart::ReceiveTask(const uint8_t *aBuf, uint16_t aBufLength)
break;
default:
Output(reinterpret_cast<const char *>(aBuf), 1);
mRxBuffer[mRxLength++] = static_cast<char>(*aBuf);
if (mRxLength < kRxBufferSize)
{
Output(reinterpret_cast<const char *>(aBuf), 1);
mRxBuffer[mRxLength++] = static_cast<char>(*aBuf);
}
break;
}
}