Commit 0dc5fdf
authored
uri: fix off-by-one in port bounds check (#140)
* uri: fix off-by-one in port bounds check
sc_uri_create() rejected ports > 65536 instead of > 65535, so the
invalid port 65536 was accepted as valid. Valid TCP/UDP ports are
0-65535 (16-bit range).
* Lock URI port boundary behavior with regression coverage
The off-by-one fix needs an executable test for both the maximum valid port and the first invalid port, so future changes cannot silently reopen the boundary.
Constraint: The maintainer requested a regression test on PR #140
Rejected: Add a standalone test binary | The existing uri test target already covers the parser and keeps the change focused
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Keep 65535 and 65536 as adjacent explicit boundary cases
Tested: Old origin/master fails at the 65536 assertion; fixed tree passes Linux GCC with ASan/UBSan, MinGW GCC 8, and official CMake/CTest
Not-tested: Zig Windows workflow remains blocked by its upstream 153-byte download
Related: #140 (comment)1 parent f522219 commit 0dc5fdf
2 files changed
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
| 249 | + | |
| 250 | + | |
249 | 251 | | |
250 | 252 | | |
251 | 253 | | |
252 | 254 | | |
253 | 255 | | |
254 | 256 | | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
255 | 265 | | |
256 | 266 | | |
257 | 267 | | |
| |||
0 commit comments