{
  "finding_id": "DF-2252",
  "title": "Off-by-one NUL write before caller buffer when inlen <= 0",
  "file": "sys/libkern/hexncpy.c",
  "lines": [52, 62],
  "verdict": "reproduced",
  "impact": "panic",
  "reproduce": {
    "build": "sh build.sh  (guest: harness appended to /usr/src/sys/libkern/hexncpy.c, pseudo-device tap added, make -j6 nativekernel KERNCONF=X86_64_GENERIC + installkernel, reboot)",
    "run": "sh run.sh   (guest: sysctl kern.df_hexncpy=1 -> canary matrix; sysctl kern.df_hexncpy=2 -> m_print zero-m_len -> panic at hexncpy.c:52)",
    "expected": "stock kernel: C2/C3 canary byte before buffer 0xaa->0x00 (1-byte NUL underflow), underflow_canary_hits=2; mode 2 panics with assertion outlen >= MIN_OUTBLEN failed in hexncpy at hexncpy.c:52, backtrace m_print() <- hexncpy(); patched kernel: canary intact, buf0=0x00, m_print returns, guest stays up"
  },
  "kernel_refs": [
    "sys/libkern/hexncpy.c:52",
    "sys/libkern/hexncpy.c:56",
    "sys/libkern/hexncpy.c:62",
    "sys/kern/uipc_mbuf.c:2533",
    "sys/kern/uipc_mbuf.c:2537",
    "sys/sys/libkern.h:67",
    "sys/sys/systm.h:116",
    "sys/dev/misc/musycc/musycc.c:754",
    "sys/net/sppp/if_spppsubr.c:5289"
  ],
  "artifacts": [
    "README.md", "VERDICT.md", "harness_hexncpy.c", "build.sh", "run.sh",
    "build.log", "run.log", "panic.txt", "fix.diff", "fix_build.log",
    "fix_run.log", "env.txt", "manifest.json", "verdict.json"
  ]
}
