From: Dobrica Pavlinusic Date: Mon, 21 Sep 2020 07:52:56 +0000 (+0200) Subject: correctly unpack unsupported data_id X-Git-Url: http://git.rot13.org/?a=commitdiff_plain;ds=sidebyside;h=9b3f509c08b8138f26871285a5bcafc38d5716c5;p=zc correctly unpack unsupported data_id --- 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";