From 9e31dc2160bbc71d78e550efa989dfabd8118bb8 Mon Sep 17 00:00:00 2001 From: Martin Preuss Date: Sun, 22 Jan 2023 17:47:42 +0100 Subject: [PATCH] aqhome: Fixed a bug. --- aqhome/serial.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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;