• David Sterba's avatar
    btrfs: factor out validation of btrfs_ioctl_vol_args::name · 5ab2b180
    David Sterba authored
    The validation of vol args name in several ioctls is not done properly.
    a terminating NUL is written to the end of the buffer unconditionally,
    assuming that this would be the last place in case the buffer is used
    completely. This does not communicate back the actual error (either an
    invalid or too long path).
    
    Factor out all such cases and use a helper to do the verification,
    simply look for NUL in the buffer. There's no expected practical change,
    the size of buffer is 4088, this is enough for most paths or names.
    Reviewed-by: default avatarBoris Burkov <boris@bur.io>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    5ab2b180
ioctl.c 117 KB