β¬’ DragonFlyBSD Kernel Audit
← triage Β· dashboard
DF-0452

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)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-0452 Β· 1 files
FileTypeDescriptionSize
fix.diff suggested-fix Octal/hex escape loops in ng_get_string_token: counter k never incremented, cons 430 B view raw

Fix verification

fixed
baseline reproduced→ patch + rebuild →patched clean

fix.diff applied + combined nativekernel build rc=0 (-Werror)

fix.diff applied + combined nativekernel build rc=0 (-Werror)
↓ fix.diffcombined build rc=0

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