Skip to content

Commit 917a804

Browse files
committed
Fix TeleinfoSerial frame analysis
- strlen was reading random memory area - add debug log
1 parent c5a53b6 commit 917a804

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

hardware/TeleinfoSerial.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,13 @@ void CTeleinfoSerial::MatchLine()
164164
#endif
165165

166166
// Is the line we got worth analysing any further?
167-
if ((strlen((const char*)&line)<4) || (line[0] == 0x0a))
167+
if ((strlen(line)<4) || (line[0] == 0x0a))
168+
{
169+
#ifdef DEBUG_TeleinfoSerial
170+
_log.Log(LOG_NORM,"Frame #%s# ignored, too short or irrelevant", line);
171+
#endif
168172
return;
173+
}
169174

170175
// Extract the elements, return if not enough and line is invalid
171176
StringSplit(line, " ", splitresults);

0 commit comments

Comments
 (0)