File tree Expand file tree Collapse file tree 3 files changed +5
-22
lines changed Expand file tree Collapse file tree 3 files changed +5
-22
lines changed Original file line number Diff line number Diff line change @@ -149,7 +149,7 @@ func (d *DN) String() string {
149
149
func decodeString (str string ) (string , error ) {
150
150
s := []rune (strings .TrimSpace (str ))
151
151
// Re-add the trailing space if the last character was an escaped space character
152
- if len (s ) > 0 && s [len (s )- 1 ] == '\\' && str [len (str )- 2 ] == ' ' {
152
+ if len (s ) > 0 && s [len (s )- 1 ] == '\\' && str [len (str )- 1 ] == ' ' {
153
153
s = append (s , ' ' )
154
154
}
155
155
@@ -234,7 +234,7 @@ func decodeEncodedString(str string) (string, error) {
234
234
// The function respects https://tools.ietf.org/html/rfc4514
235
235
func ParseDN (str string ) (* DN , error ) {
236
236
var dn = & DN {RDNs : make ([]* RelativeDN , 0 )}
237
- if str = strings .TrimSpace (str ); len ( str ) == 0 {
237
+ if strings .TrimSpace (str ) == "" {
238
238
return dn , nil
239
239
}
240
240
Original file line number Diff line number Diff line change 3
3
4
4
package ldap
5
5
6
- import (
7
- "os"
8
- "testing"
9
-
10
- ber "github.com/go-asn1-ber/asn1-ber"
11
- )
12
-
13
- func TestMain (m * testing.M ) {
14
- // For fuzz tests
15
- // See https://github.com/go-asn1-ber/asn1-ber/blob/04301b4b1c5ff66221f8f8a394f814a9917d678a/fuzz_test.go#L33-L37
16
- // for why this limitation is necessary
17
- ber .MaxPacketLengthBytes = 65536
18
-
19
- code := m .Run ()
20
- os .Exit (code )
21
- }
6
+ import "testing"
22
7
23
8
func FuzzParseDN (f * testing.F ) {
24
9
f .Add ("*" )
@@ -33,7 +18,6 @@ func FuzzParseDN(f *testing.F) {
33
18
}
34
19
35
20
func FuzzDecodeEscapedSymbols (f * testing.F ) {
36
-
37
21
f .Add ([]byte ("a\u0100 \x80 " ))
38
22
f .Add ([]byte (`start\d` ))
39
23
f .Add ([]byte (`\` ))
@@ -46,7 +30,6 @@ func FuzzDecodeEscapedSymbols(f *testing.F) {
46
30
}
47
31
48
32
func FuzzEscapeDN (f * testing.F ) {
49
-
50
33
f .Add ("test,user" )
51
34
f .Add ("#test#user#" )
52
35
f .Add ("\\ test\\ user\\ " )
Original file line number Diff line number Diff line change @@ -149,7 +149,7 @@ func (d *DN) String() string {
149
149
func decodeString (str string ) (string , error ) {
150
150
s := []rune (strings .TrimSpace (str ))
151
151
// Re-add the trailing space if the last character was an escaped space character
152
- if len (s ) > 0 && s [len (s )- 1 ] == '\\' && str [len (str )- 2 ] == ' ' {
152
+ if len (s ) > 0 && s [len (s )- 1 ] == '\\' && str [len (str )- 1 ] == ' ' {
153
153
s = append (s , ' ' )
154
154
}
155
155
@@ -234,7 +234,7 @@ func decodeEncodedString(str string) (string, error) {
234
234
// The function respects https://tools.ietf.org/html/rfc4514
235
235
func ParseDN (str string ) (* DN , error ) {
236
236
var dn = & DN {RDNs : make ([]* RelativeDN , 0 )}
237
- if str = strings .TrimSpace (str ); len ( str ) == 0 {
237
+ if strings .TrimSpace (str ) == "" {
238
238
return dn , nil
239
239
}
240
240
You can’t perform that action at this time.
0 commit comments