配置区超大,超出了数据流范围,只同步前16字节

This commit is contained in:
nnhy 2015-11-18 12:13:39 +00:00
parent 5c808657b0
commit 995f12cf89
2 changed files with 14 additions and 7 deletions

View File

@ -336,6 +336,8 @@ void TinyClient::Report(Message& msg)
// 0x01子功能主数据区
void TinyClient::ReportPing0x01(Stream& ms)
{
TS("TinyClient::ReportPing0x01");
byte len = Store.Data.Length() - 1;
if(ms.Position() + 3 + len > Control->Port->MaxSize) return;
@ -349,8 +351,11 @@ void TinyClient::ReportPing0x01(Stream& ms)
// 0x02子功能配置区
void TinyClient::ReportPing0x02(Stream& ms)
{
TS("TinyClient::ReportPing0x02");
byte len2 = sizeof(Cfg->Length);
byte len = Cfg->Length - len2;
if(len > 0x10) len = 0x10;
if(ms.Position() + 1 + len2 + 1 + len > Control->Port->MaxSize) return;
ms.Write((byte)0x02); // 子功能码
@ -363,6 +368,8 @@ void TinyClient::ReportPing0x02(Stream& ms)
// 0x03子功能硬件校验码
void TinyClient::ReportPing0x03(Stream& ms)
{
TS("TinyClient::ReportPing0x03");
if(ms.Position() + 3 > Control->Port->MaxSize) return;
ms.Write((byte)0x03); // 子功能码