diff --git a/aqhome/serial.c b/aqhome/serial.c index b2feb0a..b885e38 100644 --- a/aqhome/serial.c +++ b/aqhome/serial.c @@ -137,11 +137,11 @@ int AQH_Serial_Recv(AQH_SERIAL *sr, uint8_t *buf, int len) DBG_INFO(NULL, "here (%d)", rv); return rv; } - msgLen=buf[1]+1; /* add one byte for XOR checksum */ - buf+=2; + msgLen=buf[1]; + buf+=2; /* two bytes already read */ /* read message and XOR byte */ - rv=_readForced(sr, buf, msgLen); + rv=_readForced(sr, buf, msgLen+1); /* add one byte for XOR checksum */ if (rv<0) { DBG_INFO(NULL, "here (%d)", rv); return rv;