namspace: format build_base NW_HPATH debug output safely
All checks were successful
Source release / source-package (push) Successful in 45s

Stop logging the build_base NW_HPATH component buffer as a raw C string.

The path buffer is length-prefixed and not NUL-terminated. Printing it with %s
can over-read into following packet or process memory and pollute unrelated
client/test output, for example ZIP output appearing inside MAPDEBUG lines.

Use the safe NW_HPATH component formatter for the build_base ENTER log line as
well as individual component debug output.

No protocol behavior change.
This commit is contained in:
Mario Fetka
2026-05-29 14:54:56 +02:00
parent 519ee500a0
commit 98630eede8

View File

@@ -945,7 +945,8 @@ static int build_base(int namespace,
XDPRINTF((3, 0,
"MAPDEBUG build_base ENTER ns=%d flag=0x%x volume=%d base0=0x%02x base32=0x%lx mode=%d pathes=`%s`",
namespace, (int)nwp->flag, (int)nwp->volume, (unsigned)nwp->base[0],
(unsigned long)GET_32(nwp->base), mode, pathes ? (char*)pathes : ""));
(unsigned long)GET_32(nwp->base), mode,
debug_hpath_components(nwp, pathes)));
if (!nwp->flag) { /* short directory handle */
result=nw_dir_get_vol_path((int)nwp->base[0], nwpath->path);