Skip to content

fix: prevent BindHeaders panic on nil/empty header values (#3169) - #3178

Open
manish-9245 wants to merge 1 commit into
labstack:masterfrom
manish-9245:fix/3169-bind-headers-panic
Open

manish-9245 wants to merge 1 commit into
labstack:masterfrom
manish-9245:fix/3169-bind-headers-panic

Conversation

@manish-9245

Copy link
Copy Markdown

Fixes #3169. BindHeaders panicked with index out of range when a header key mapped to nil or empty []string, via v[0]/inputValue[0] in bindData for struct and map[string]string/map[string]any targets. Fixed by skipping entries with no values in bindData (map loop and struct field path), leaving fields/maps untouched. Tests: go build ./... (ok); go test -count=1 ./... (ok: echo, echotest, middleware); go test -race -count=1 . ./middleware/... (ok); gofmt -l on changed files (clean); new TestBindHeadersEmptyValues fails before (panic at bind.go) and passes after.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BindHeaders panics on nil or empty header value slices

1 participant