pires / go-proxyproto

A Go library implementation of the PROXY protocol, versions 1 and 2.
Apache License 2.0
488 stars 109 forks source link

header.go prevent otherHeader.rawTLVs being nil #104

Closed hilbix closed 2 weeks ago

hilbix commented 11 months ago

If header.Version != otherHeader.Version then otherHeader.rawTLVs is not present.

This resulted in a crash at my side. Switching position of the 2 ifs solves it.

pires commented 11 months ago

Thank you for contributing.

Can you, please, add a test that covers for your scenario, ie that triggers the panic?

coveralls commented 11 months ago

Coverage Status

coverage: 95.017%. remained the same when pulling 7095f70d0d8969d24541970a363026174d0ac525 on hilbix:tino into e5b291b295b4a6e0425a134c8b3bfa6b2e692866 on pires:main.