aboutsummaryrefslogtreecommitdiff
path: root/ber
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-06-30 20:01:32 +0200
committerDimitri Sokolyuk <demon@dim13.org>2015-06-30 20:01:32 +0200
commit784632de3fb2af5ee5bc279a3f9ad0fc39321824 (patch)
treef6143fdc71c07c77631d849da2db6955107053e8 /ber
parentd392aba19ba8fd8bf648cc97439889e3ce97c836 (diff)
Fix uint parser
Diffstat (limited to 'ber')
-rw-r--r--ber/class.go2
-rw-r--r--ber/int.go2
2 files changed, 2 insertions, 2 deletions
diff --git a/ber/class.go b/ber/class.go
index 0839c05..0a98b80 100644
--- a/ber/class.go
+++ b/ber/class.go
@@ -119,7 +119,7 @@ func Ident(b []byte) (Class, Kind, Tag, int) {
func Length(b []byte) (int, int) {
if b[0] & 0x80 != 0 {
- l := b[0] & 0x7f
+ l := int(b[0] & 0x7f)
i := unmarshalUint(b[1:l+1])
return int(i), int(l+1)
} else {
diff --git a/ber/int.go b/ber/int.go
index 5bfcd89..bbf93ea 100644
--- a/ber/int.go
+++ b/ber/int.go
@@ -34,7 +34,7 @@ func unmarshalInt(b []byte) (i int64) {
func unmarshalUint(b []byte) (i int64) {
for n, v := range b {
- i += int64(v) << uint((n-1)*8)
+ i += int64(v) << uint(n*8)
}
return
}