HomeFreeBSD

mount(8): Avoid truncation when fstab-formatting unionfs mount info

Description

mount(8): Avoid truncation when fstab-formatting unionfs mount info

When displaying unionfs mounts in fstab format (mount -p), mount(8)
currently uses strlcpy to remove the disposition prefix from the mount
name returned by getmntinfo(3). But strlcpy, like strcpy before it,
does not guarantee correct behavior if the source and destination
buffers overlap.

Just offset the buffer and avoid the destructive copy in the first
place.

PR: 283420
Reviewed by: imp (previous version), olce
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D48177

Details

Provenance
jahAuthored on Sun, Dec 22, 6:36 AM
Reviewer
imp
Differential Revision
D48177: mount(8): Avoid truncation when fstab-formatting unionfs mount info
Parents
rG788e1eb7c199: makefs: Remove impossible if condition
Branches
Unknown
Tags
Unknown