Octal/hex escape loops in ng_get_string_token: counter k never incremented, consumes all consecutive digits
Summary
ng_get_string_token(:1599-1617): octal loop for(x=k=0;k<3&&*v>=0x30&&*v<=0x37;v++)(:1601) β k init to 0 but NEVER incremented (increment clause is v++ not k++,v++). k<3 always true -> consumes ALL consecutive octal digits instead of max 3. Hex loop(:1609) identical bug k never incremented. Input \x4142 parsed as single escape (decoded 0x4142=0x42) not \x41(A)+literal 42. No memory safety: cbuf sized strlen(s+start) suffices since escapes only shrink. Signed int x overflow UB on long sequences.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-0452 Β· 1 files| File | Type | Description | Size | |
|---|---|---|---|---|
| fix.diff | suggested-fix | Octal/hex escape loops in ng_get_string_token: counter k never incremented, cons | 430 B | view raw |
Fix verification
fixedfix.diff applied + combined nativekernel build rc=0 (-Werror)
fix.diff applied + combined nativekernel build rc=0 (-Werror)
Confirmed kernel references
β
Detail
Exploit chain
none (Info severity)
Evidence (decisive lines)
Source-confirmed at sys/netgraph/netgraph/ng_parse.c:1599: octal/hex escape counter k never incremented, consumes all digits
Verified recommended fix
Source-confirmed at sys/netgraph/netgraph/ng_parse.c:1599: octal/hex escape counter k never incremented, consumes all digits
Verdict
Source-confirmed at sys/netgraph/netgraph/ng_parse.c:1599: octal/hex escape counter k never incremented, consumes all digits
No comments yet.