Commit a413325
committed
fix(bin): reject oversized ports before arithmetic conversion
parse_port_from_url() converted the digit string with $((10#$port))
before bounding it. Bash evaluates in 64 bits and wraps silently, so an
out-of-range value could re-enter 1..65535 and be accepted as a real
port: 18446744073709551617 parsed as 1, and 18446744073709559616 as
8000. The preflight would then abort startup naming a port that was
never configured.
Normalise the leading-zero form textually instead, reject anything
longer than five digits, and only then convert and range-check. Java
reads 08080 as 8080, so that form is still accepted.
Covers both wrapping values, an all-zero port, and a long leading-zero
form in the URL-parsing table.1 parent ea81ad7 commit a413325
2 files changed
Lines changed: 13 additions & 2 deletions
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
179 | | - | |
180 | | - | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
181 | 186 | | |
182 | 187 | | |
183 | 188 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
96 | 102 | | |
97 | 103 | | |
98 | 104 | | |
| |||
0 commit comments