[libvirt] [PATCH] dnsmasq: Fix parsing of the version number

Laine Stump laine at laine.org
Thu Dec 6 18:22:53 UTC 2012


On 12/06/2012 07:39 AM, Michal Privoznik wrote:
> On 06.12.2012 13:29, Laine Stump wrote:
>> On 12/06/2012 06:34 AM, Michal Privoznik wrote:
>>  
>> -    p = STRSKIP(buf, DNSMASQ_VERSION_STR);
>> -    if (!p)
>> +    if (!(p = strstr(buf, DNSMASQ_VERSION_STR)))
>>         goto fail;
>> +    p += sizeof(DNSMASQ_VERSION_STR) - 1;
>> Why -1 ? That happens to work, but wouldn't if the version string didn't
>> end with a space.
> sizeof(const char[]) counts '\0' at the end. We don't want that here.

Right. I was caffeineless and saw that as strlen instead of sizeof :-)




More information about the libvir-list mailing list