Update of /cvsroot/perl-ldap/asn/lib/Convert/ASN1
In directory usw-pr-cvs1:/tmp/cvs-serv2349/lib/Convert/ASN1
Modified Files:
_decode.pm
Log Message:
Patch from Wolfgang Laun
Addition of prepare_file and the change prepare to accept a filehandle.
POD updates.
Fix decode of nested indefinate lengths
Index: _decode.pm
===================================================================
RCS file: /cvsroot/perl-ldap/asn/lib/Convert/ASN1/_decode.pm,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- _decode.pm 10 Feb 2002 16:12:16 -0000 1.13
+++ _decode.pm 25 Mar 2002 07:46:08 -0000 1.14
@@ -518,6 +518,7 @@
sub _decode_tl {
my($pos,$end,$larr) = @_[1,2,3];
+
my $indef = 0;
my $tag = substr($_[0], $pos++, 1);
@@ -561,16 +562,17 @@
sub _scan_indef {
my($pos,$end,$larr) = @_[1,2,3];
- @$larr = ();
- my @depth = ( $pos );
+ @$larr = ( $pos );
+ my @depth = ( \$larr->[0] );
while(@depth) {
return if $pos+2 > $end;
if (substr($_[0],$pos,2) eq "\0\0") {
my $end = $pos;
- my $start = shift @depth;
- unshift @$larr, $end-$start;
+ my $stref = shift @depth;
+ # replace pos with length = end - pos
+ $$stref = $end - $$stref;
$pos += 2;
next;
}
@@ -579,7 +581,6 @@
if((ord($tag) & 0x1f) == 0x1f) {
my $b;
- my $n=1;
do {
$tag .= substr($_[0],$pos++,1);
$b = ord substr($tag,-1);
@@ -596,7 +597,9 @@
$pos += $len + unpack("N", "\0" x (4 - $len) . substr($_[0],$pos,$len));
}
else {
- unshift @depth, $pos;
+ # reserve another list element
+ push @$larr, $pos;
+ unshift @depth, \$larr->[-1];
}
}
else {
|