mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
syscall: allow empty string argument to SetsockoptString
Don't panic with "index out of range" on empty string argument. Fixes golang/go#31277 Change-Id: I005f9523caec76337cb2ec87272a6be4736bce18 Reviewed-on: https://go-review.googlesource.com/c/go/+/170937 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
cea44714fb
commit
db0c524211
2 changed files with 13 additions and 1 deletions
|
|
@ -355,3 +355,11 @@ func TestSeekFailure(t *testing.T) {
|
|||
t.Fatalf("Seek(-1, 0, 0) return error with empty message")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSetsockoptString(t *testing.T) {
|
||||
// should not panic on empty string, see issue #31277
|
||||
err := syscall.SetsockoptString(-1, 0, 0, "")
|
||||
if err == nil {
|
||||
t.Fatalf("SetsockoptString: did not fail")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue