From 56be9a6d539ba9ce1f04b6e7d65d7fe5a18a1ca9 Mon Sep 17 00:00:00 2001 From: kaihs <> Date: Sat, 15 Dec 2018 13:59:18 +0000 Subject: [PATCH] WMBus: add packet length check for frame type B git-svn-id: https://svn.fhem.de/fhem/trunk@17979 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/WMBus.pm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fhem/FHEM/WMBus.pm b/fhem/FHEM/WMBus.pm index 0aa0e98c7..9780ffd09 100644 --- a/fhem/FHEM/WMBus.pm +++ b/fhem/FHEM/WMBus.pm @@ -1913,6 +1913,13 @@ sub decodeLinkLayer($$) # first contains the header (TL_BLOCK), L field and trailing crc # L field is included in crc calculation # each following block contains only data and trailing crc + if (length($self->{msg}) < $self->{lfield}) { + $self->{errormsg} = "message too short, expected " . $self->{lfield} . ", got " . length($self->{msg}) . " bytes"; + $self->{errorcode} = ERR_MSG_TOO_SHORT; + return 0; + } + + my $length = 129; if ($self->{lfield} < $length) { $length = $self->{lfield};