From 98630eede8750f1cd36f28837747e0b1824cbb1b Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Fri, 29 May 2026 14:54:56 +0200 Subject: [PATCH] namspace: format build_base NW_HPATH debug output safely 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. --- src/namspace.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/namspace.c b/src/namspace.c index c69b13a..944ea42 100644 --- a/src/namspace.c +++ b/src/namspace.c @@ -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);