die when trying to decode short tag
authorDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 21 Oct 2014 14:51:23 +0000 (16:51 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 21 Oct 2014 14:57:54 +0000 (16:57 +0200)
lib/Biblio/RFID/RFID501.pm

index 5c75088..1642dc9 100644 (file)
@@ -119,6 +119,10 @@ sub to_hash {
 
        $data = join('', @$data) if ref $data eq 'ARRAY';
 
+       if ( length($data) < 24 ) {
+               die "short data from tag ", length($data), " < 24 bytes";
+       }
+
        warn "## to_hash ",dump($data);
 
        my ( $u1, $set_item, $u2, $type, $content, $br_lib, $custom, $zero ) = unpack('C4Z16Nl>l',$data);