Re: [PATCH 2/3] network: allow disabling dnsmasq's DNS server

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

 



On 19.08.2016 17:26, Laine Stump wrote:

>>   Moreover, if the value has been modified, we can't be
>> entirely sure it was modified to something outside boundaries. It might
>> as well be changed from 'no' to 'yes' (or vice versa) which is not any
>> worse than the previous case IMO.
> 
> I don't follow the chain of logic there.
> 

You say that you're worried about hidden change of value of a variable
in our code. Long story short.

int enable;
enable = parseXML();
if (validate(enable) < 0) { /* valid values are 1 or 2 */
  virReportError();
  die();
}

/* For demonstrational purposes assume: */
enable = 1;

/* now the netowrk object lives its own life and something might
accidentally change enable */
enable = 3;

/* but where does this 3 come from? What if the buggy code changes that
to say 2? */
enable = 2;

formatXML(enable);

Yes, we won't crash, but we will not produce correct XML either. Valid
one, but not what user expected. Then again, I can live with that check
being there, it's just that I don't find it much helpful and consistent
with the rest of our code.

Michal

--
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]