Commit ab68dad
committed
in_kubernetes_events: reject signed uint64 strings in record_get_field_uint64
strtoull() itself accepts a leading '+'/'-' and skips leading whitespace,
so a resourceVersion string like "-5" silently wrapped around into
18446744073709551611 instead of being rejected. Kubernetes always
serializes resourceVersion as a plain unsigned digits-only decimal
string, so require the first byte to be a digit before calling
strtoull(), on top of the existing errno/ERANGE and full-consumption
checks.
Confirmed via a standalone guard-page harness (same shape as the
existing OOB reproduction in this PR): "-5" and "+5" are now rejected
(previously accepted, wrapping "-5" to UINT64_MAX-4), a valid
digits-only value still round-trips correctly, and overflow beyond
UINT64_MAX still correctly fails via the existing ERANGE check.
Addresses a CodeRabbit review comment on this PR.
Signed-off-by: Raphael Zanarelli <zanarelli.dev@gmail.com>
Signed-off-by: zanarelli <zanarelli.dev@gmail.com>1 parent e3c31af commit ab68dad
1 file changed
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
297 | 298 | | |
298 | 299 | | |
299 | 300 | | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
300 | 313 | | |
301 | 314 | | |
302 | 315 | | |
| |||
0 commit comments