aboutsummaryrefslogtreecommitdiff
path: root/ber/new/unmarshal.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-09-26 00:29:02 +0200
committerDimitri Sokolyuk <demon@dim13.org>2015-09-26 00:29:02 +0200
commit108e965580cbbae0d5029b7cc2ca592bd955883e (patch)
treeb031c9ab06f9913f2bb74f5e463ca1f0eea28092 /ber/new/unmarshal.go
parent4083fc0161bcf1a669ad0af50145ed92c8b776ce (diff)
Add len test
Diffstat (limited to 'ber/new/unmarshal.go')
-rw-r--r--ber/new/unmarshal.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/ber/new/unmarshal.go b/ber/new/unmarshal.go
index 9fd27cd..b29eba5 100644
--- a/ber/new/unmarshal.go
+++ b/ber/new/unmarshal.go
@@ -5,9 +5,10 @@ func (s *state) unmarshalLen() int {
if b&0x80 == 0 {
return int(b)
}
+ l := int(b) & 0x7f
var n int
- for i, v := range s.Next(int(b)) {
- n |= int(v) << uint(i*8)
+ for i, v := range s.Next(l) {
+ n |= int(v) << uint((l-i-1)*8)
}
return n
}