mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-09 13:45:33 +00:00
00_ZWDongle.pm: Reset on 0-length data (Forum #71457)
git-svn-id: https://svn.fhem.de/fhem/trunk@14174 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
ea6a4f772e
commit
95be8b6983
@ -781,9 +781,16 @@ ZWDongle_Read($@)
|
||||
last;
|
||||
}
|
||||
|
||||
last if(length($data) < 4);
|
||||
|
||||
my $len = substr($data, 2, 2);
|
||||
my $l = hex($len)*2;
|
||||
last if(!$l || length($data) < $l+4); # Message not yet complete
|
||||
last if(length($data) < $l+4); # Message not yet complete
|
||||
|
||||
if($l < 4) { # Bogus messages, forget the rest
|
||||
$data = "";
|
||||
last;
|
||||
}
|
||||
|
||||
$msg = substr($data, 4, $l-2);
|
||||
my $rcs = substr($data, $l+2, 2); # Received Checksum
|
||||
|
Loading…
x
Reference in New Issue
Block a user