New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix negative port detection for IPv6 addresses on 32-bit #4911

Merged
merged 1 commit into from Jan 24, 2017

Conversation

Projects
None yet
2 participants
@rgacogne
Member

rgacogne commented Jan 15, 2017

Short description

On a 32-bit Arch, our test_ComboAddress unit test fails because ComboAddress("[::1]:-6") is considered valid. This is caused by stoul() not throwing for a negative value and returning an unsigned long value using unsigned integer wraparound rules. Since we used to store the result value in a signed int and treat negative values as if the port was not set, the test failed.

Checklist

I have:

  • read the CONTRIBUTING.md document
  • compiled and tested this code
  • included documentation (including possible behaviour changes)
  • documented the code
  • added regression tests
  • added unit tests
Fix negative port detection for IPv6 addresses on 32-bit
On a 32-bit Arch, our `test_ComboAddress` unit test fails because
`ComboAddress("[::1]:-6")` is considered valid. This is caused by
`stoul()` not throwing for a negative value and returning an `unsigned
long` value using unsigned integer wraparound rules. Since we used to
store the result value in a `signed int` and treat negative values
as if the port was not set, the test failed.

@pieterlexis pieterlexis merged commit 5753d90 into PowerDNS:master Jan 24, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@rgacogne rgacogne deleted the rgacogne:invalid-v6-port-master branch Jan 24, 2017

pieterlexis added a commit that referenced this pull request Feb 17, 2017

Merge pull request #4936 from rgacogne/auth40-backport-4911
Backport #4911: Fix negative port detection for IPv6 addresses on 32-bit

pieterlexis added a commit that referenced this pull request Feb 17, 2017

Merge pull request #4935 from rgacogne/rec40-backport-4911
Backport #4911: Fix negative port detection for IPv6 addresses on 32-bit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment