Re: [PATCH] storage: add check for invalid volume name

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

 



On 04/10/2014 10:02 PM, Jincheng Miao wrote:
> If volume name is a path, storageVolCreateXML appends that name to
> the specified pool path, that will taint other pools. Adding the
> volume check is better for sanity.
> 
> Signed-off-by: Jincheng Miao <jmiao@xxxxxxxxxx>
> ---
>  src/storage/storage_driver.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 

>  
> +    /* Make sure the volume name is not a path */
> +    if (last_component(newvol->name) != newvol->name) {

Why not just:

if (strchr(newvol->name, '/'))

Also, shouldn't we forbid things like "." and ".." as the newvol name?

> +        virReportError(VIR_ERR_INTERNAL_ERROR,
> +                       _("storage volume name '%s' is a path"),

I don't like the word "path" in a user-facing error message for anything
other than a list of directory names separated by colon; better would be
a message such as "requested storage volume name '%s' cannot contain /"
or "requested storage volume name '%s' not permitted".

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]