Re: [PATCH 4/5] phyp: Fix too small buffer allocation in phypAttachDevice

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

 



On 04/14/2011 06:00 AM, Matthias Bolte wrote:
>>  ACK, we just need to make sure contains_specialcharacters() and
>> escape_specialcharacters() don't diverge on the charater set. Maybe
>> add a comment in escape_specialcharacters() to this effect.
>>
>> Daniel
>>
> 
> I just moved the character set to a define, like this and pushed the result.
> 
> @@ -905,32 +911,10 @@ contains_specialcharacters(const char *src)
> 
>      for (i = 0; i < len; i++) {
>          switch (src[i]) {
> +        SPECIALCHARACTER_CASES
> +            return true;
> +        default:
> +            continue;
>          }

Fair enough - continue the loop until we find a special character.

>      }
> 
> @@ -954,35 +938,11 @@ escape_specialcharacters(const char *src)
> 
>      for (i = 0; i < len; i++) {
>          switch (src[i]) {
> +        SPECIALCHARACTER_CASES
> +            continue;
> +        default:
> +            dst[j] = src[i];
> +            j++;

Huh?  That is not escaping characters, but omitting them!  This code
seems rather broken; was the intent to add \ escaping before special
characters?

I _really_ want to add something to src/util/util.h that outputs
shell-escaped strings automatically (virCommandToString needs to use it,
and the current 'virsh echo --shell' could share it), so that all
clients that are doing shell escaping use a single entry point rather
than re-coding ad-hoc methods.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
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]