From 9b3f509c08b8138f26871285a5bcafc38d5716c5 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Mon, 21 Sep 2020 09:52:56 +0200 Subject: [PATCH] correctly unpack unsupported data_id --- unpack.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/unpack.pl b/unpack.pl index 1e04e2d..9d9b622 100755 --- a/unpack.pl +++ b/unpack.pl @@ -155,8 +155,9 @@ while ( $data ) { my $data_id = unpack( 'C', substr($data,0,1) ); my $data_id_desc = $protocol->{$data_id}->{description}; if ( ! $data_id_desc ) { - warn "ERROR: no description for data_id $data_id SKIPPING!"; - $data = substr($data,1); + my $len = unpack('C', substr($data,1,1)); + printf "ERROR: no description for data_id %d 0x%2x len %d SKIPPING!\n", $data_id, $data_id, $len; + $data = substr($data,2 + $len); next; } my $pack_fmt = $protocol->{$data_id}->{pack_fmt} || die "can't find pack_fmt for data_id $data_id"; -- 2.20.1