Repository navigation
Fix GH-25137: Reject malformed SNMP ports - #25138
Open
somethingwithproof wants to merge 1 commit into
Open
somethingwithproof wants to merge 1 commit into
somethingwithproof wants to merge 1 commit into
Conversation
Member
|
Hi @somethingwithproof that looks like an improvement for master, that would need to focus on improving port checks that had been introduced in 8.5 IMHO. |
The remote port suffix in an SNMP hostname was parsed with atoi(), so an empty, nonnumeric or partially numeric suffix was read as 0 or as its leading digits, and a long digit string overflowed. Require one or more decimal digits and nothing else, keeping the existing 0..65535 range and error message. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
somethingwithproof
force-pushed
the
fix/snmp-strict-port-parsing
branch
from
November 15, 2026 02:51
edb4b9e to
57df8b9
Compare
somethingwithproof
requested review from
TimWolla and
dstogov
as code owners
November 15, 2026 02:51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #25137.
Master already rejects remote ports outside
0..65535, but still parses them withatoi(), so an empty, nonnumeric or partially numeric suffix (host:,host:abc,host:123abc) is read as 0 or as its leading digits, and a long digit string overflows. This replacesatoi()with a parser that requires one or more decimal digits and nothing else, keeping the existing range and error message.The new
gh25137.phptcovers IPv4 and bracketed IPv6 hostnames, both range boundaries, an overflowing value, and the procedural and OO APIs. UPGRADING notes the stricter parsing.Verification: clang debug build with ASan and UBSan.
gh25137.phptfails on master and passes with this change; all runnableext/snmptests pass.