Skip to content

Commit

Permalink
Merge pull request #20 from ilylia/master
Browse files Browse the repository at this point in the history
fix superfluous leading zeros
  • Loading branch information
vjeantet authored Sep 19, 2017
2 parents c3e1da8 + 22e164f commit 479fece
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,13 @@ func readTagAndLength(conn *bufio.Reader, bytes *[]byte) (ret ldap.TagAndLength,
}
ret.Length <<= 8
ret.Length |= int(b)
if ret.Length == 0 {
// DER requires that lengths be minimal.
err = ldap.StructuralError{"superfluous leading zeros in length"}
return
}
// Compat some lib which use go-ldap or someone else,
// they encode int may have leading zeros when it's greater then 127
// if ret.Length == 0 {
// // DER requires that lengths be minimal.
// err = ldap.StructuralError{"superfluous leading zeros in length"}
// return
// }
}
}

Expand Down

0 comments on commit 479fece

Please sign in to comment.