NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/60627: restore(8): -M mtree output fails to vis-encode paths



>Number:         60627
>Category:       bin
>Synopsis:       restore(8): -M mtree output fails to vis-encode paths
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Aug 21 03:45:00 +0000 2026
>Originator:     Taylor R Campbell
>Release:        current, 11, 10, 9, ...
>Organization:
The NetMtree Restoration, Inc.
>Environment:
>Description:

	The restore(8) `-M mtree' option is supposed to print
	owner/group/mode/link/&c. information in mtree format so it can
	later be passed to mtree(8) to restore those attributes.

	But it passes pathnames through verbatim instead of quoting
	them with vis(3) like the mtree format demands:

    410 void
    411 writemtree(const char *name, const char *type,
    412     const uid_t uid, const gid_t gid, const mode_t mode, const u_long flags)
    413 {
    414 	const char *sep = "";
    415 	if ((name[0] != '.') || (name[1] != '/' && name[1] != '\0'))
    416 		fprintf(Mtreefile, "./");
    417 	fprintf(Mtreefile, "%s type=%s uid=%d gid=%d mode=%#4.4o",
    418 	    name, type, uid, gid,
    419 	    mode & (S_IRWXU | S_IRWXG | S_IRWXO | S_ISUID | S_ISGID | S_ISTXT));

https://nxr.netbsd.org/xref/src/sbin/restore/utilities.c?r=1.24#410

>How-To-Repeat:

	code inspection and/or just trip over it, really

>Fix:

	call vis(3) (well, strsnxvisywig or whatever)




Home | Main Index | Thread Index | Old Index