# DF-5702 — kernel strtoq/strtouq "0x" prefix consumed without hex-digit lookahead (C99 endptr contract violation; kernel/libc parser desync)

`sys/libkern/strtoq.c:72-77` / `sys/libkern/strtouq.c:70-75`

## Reproduce (on the DragonFly guest)

```sh
scp -F dfbsd-qemu/config kernel_strtoq_shim.h diffharness.c build.sh run.sh dfbsd-maxx:/tmp/df5702/
vm.sh run_user 'cd /tmp/df5702 && ./build.sh && ./run.sh'
```

- build: seds the untouched `/usr/src/sys/libkern/{strtoq,strtouq}.c` (cksum
  verified against the repo) into userland-compilable `k_strtoq.c`/`k_strtouq.c`
  plus fix-only variants, compiles with guest cc 8.3.
- run: 43-input × 9-base corpus × signed/unsigned, comparing kernel vs libc
  VALUE / endptr-offset / ERANGE.

## Expected

```
SUMMARY:
  kernel-vs-libc VALUE divergences      : 0
  kernel-vs-libc ENDPTR divergences     : 28   <- DF-5702 (all and only "0x"+non-xdigit, bases 0/16)
  invalid-base semantic diffs           : 258  <- legacy BSD class, no kernel caller affected
  saturation w/o ERANGE (DF-2230 class) : 79   <- known DF-2230 root cause, not re-reported
  patched-kernel residual ENDPTR diffs  : 0    <- fix validated
  patched-kernel VALUE regressions      : 0
harness exit: 0
```

Deterministic: identical md5 across 3 runs (run.1.log / run.log / run2.log).

Impact: fail-closed semantic divergence only (kernel stricter than libc);
no memory-safety impact, no value desync. Severity Low.

## Artifacts

- `diffharness.c`, `kernel_strtoq_shim.h` — harness
- `build.sh`, `run.sh` — exact commands
- `build_full.log` — full untrimmed build output (guest)
- `run.log` (run 1, via tee), `run.1.log` (copy), `run2.log` (guest-side run)
- `k_strtoq.c`, `k_strtouq.c` — guest-sed copies of the kernel sources
- `k_strtoq_fix.c`, `k_strtouq_fix.c` — fix-only variants
- `fix.diff` — git-apply-able one-guard fix (apply-tested)
- `env.txt` — guest uname/compiler/sysctl
- `guest_status.txt` — build/run exit codes
