Hi Jerry,

On Mon, 8 Aug 2022 12:46:20 -0600, Jerry Hoemann wrote:
> My concerns are at a lower level.  There appears to be a difference in
> interpretation between Linux and Free BSD tool chain on whether passing
> a NULL as format is legal.  I did a quick read of the fprintf function
> in the Ansi C 99 standard and I'm of the believe that NULL is not legal.

You are right, NULL is not legal in this context. BSD is strict and
correct, glibc is (IMHO) too permissive.

> But even if my interpretation is incorrect, there is still a difference
> between the two and I am not going to be testing under Free BSD.
> So, I'd probably go ahead an proactively change functions like
> pr_handle_name, pr_attr, etc., to check format like pr_list_start does
> to protect against this type of issue getting hit in the future.

I tend to prefer the other way, that is, find such problem at
compilation time (with the compiler itself, or a static code analyzer)
and get the source code right. I don't like checking at run-time for
errors that are simply not supposed to happen if the code is right.

(And I know not all developers think like that, and I understand their
reasoning, but personally I prefer fixing problems where they are than
catching them later, because the overall cost is much smaller.)

-- 
Jean Delvare
SUSE L3 Support

_______________________________________________
https://lists.nongnu.org/mailman/listinfo/dmidecode-devel

Reply via email to