File tree Expand file tree Collapse file tree 2 files changed +2
-3
lines changed Expand file tree Collapse file tree 2 files changed +2
-3
lines changed Original file line number Diff line number Diff line change @@ -64,7 +64,6 @@ typedef struct __attribute__((__packed__))
6464{
6565 Cmd cmd;
6666 uint8_t len;
67- uint8_t data[];
6867} WriteDataCmd;
6968
7069typedef struct __attribute__ ((__packed__))
@@ -119,7 +118,6 @@ typedef struct __attribute__((__packed__))
119118{
120119 uint8_t code;
121120 uint8_t info;
122- uint8_t data[];
123121} RespHeader;
124122
125123typedef struct __attribute__ ((__packed__))
Original file line number Diff line number Diff line change @@ -142,6 +142,7 @@ int Reader::handleStatus(char *pbuf, uint32_t len)
142142int Reader::handleData (char *pbuf, uint32_t len)
143143{
144144 RespHeader *header = reinterpret_cast <RespHeader *>(pbuf);
145+ char *data = pbuf + sizeof (RespHeader);
145146 uint8_t dataSize = header->info ;
146147 size_t headerSize = sizeof (RespHeader), packetSize = headerSize + dataSize;
147148
@@ -161,7 +162,7 @@ int Reader::handleData(char *pbuf, uint32_t len)
161162 return -1 ;
162163 }
163164
164- memcpy (rbuf + readOffset, header-> data , dataSize);
165+ memcpy (rbuf + readOffset, data, dataSize);
165166 readOffset += dataSize;
166167 bytesRead += dataSize;
167168
You can’t perform that action at this time.
0 commit comments