projects
/
zc
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9efb310
)
correctly unpack unsupported data_id
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Mon, 21 Sep 2020 07:52:56 +0000
(09:52 +0200)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Mon, 21 Sep 2020 07:52:56 +0000
(09:52 +0200)
unpack.pl
patch
|
blob
|
history
diff --git
a/unpack.pl
b/unpack.pl
index
1e04e2d
..
9d9b622
100755
(executable)
--- 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 ) {
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";
next;
}
my $pack_fmt = $protocol->{$data_id}->{pack_fmt} || die "can't find pack_fmt for data_id $data_id";