mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-16 23:06:05 +00:00
Added some guarding code, if the TCP buffer got corrupted
git-svn-id: https://svn.fhem.de/fhem/trunk@3247 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
8f919d4f7c
commit
8ed776eff0
@ -261,6 +261,11 @@ FBAHA_Read($@)
|
||||
my $msg;
|
||||
while(length($data) >= 16) {
|
||||
my $len = hex(substr($data, 4,4))*2;
|
||||
if($len < 16 || $len > 10240) { # Out of Sync
|
||||
Log 1, "FBAHA: resetting buffer as we are out of sync ($len)";
|
||||
$hash->{PARTIAL} = "";
|
||||
return "";
|
||||
}
|
||||
last if($len > length($data));
|
||||
$msg = substr($data, 0, $len);
|
||||
$data = substr($data, $len);
|
||||
|
Loading…
x
Reference in New Issue
Block a user