• Siddhesh Poyarekar's avatar
    vfs: escape hash as well · ed5fce76
    Siddhesh Poyarekar authored
    When a filesystem is mounted with a name that starts with a #:
    
     # mount '#name' /mnt/bad -t tmpfs
    
    this will cause the entry to look like this (leading space added so
    that git does not strip it out):
    
     #name /mnt/bad tmpfs rw,seclabel,relatime,inode64 0 0
    
    This breaks getmntent and any code that aims to parse fstab as well as
    /proc/mounts with the same logic since they need to strip leading spaces
    or skip over comment lines, due to which they report incorrect output or
    skip over the line respectively.
    
    Solve this by translating the hash character into its octal encoding
    equivalent so that applications can decode the name correctly.
    Signed-off-by: default avatarSiddhesh Poyarekar <siddhesh@gotplt.org>
    Signed-off-by: default avatarIan Kent <raven@themaw.net>
    Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
    ed5fce76
proc_namespace.c 8.13 KB