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

Matthias Bolte matthias.bolte at googlemail.com
Thu Apr 14 17:06:19 UTC 2011


2011/4/14 Eric Blake <eblake at redhat.com>:
> 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?

Well, The code was this way from the beginning, we'll have to ask
Eduardo about its intention here.

Matthias




More information about the libvir-list mailing list