Kevin Mescher wrote:
> 
> I think there are a few options for fixing this:
> 
> 1.    Fix the pa_strbuf_printf function to go through the format string, and 
> for every %s, check and correct any NULL pointer.  I'm not sure how to do 
> this one.
> 
> 2.    Fix each call to pa_strbuf_printf.  This is not difficult, but would be 
> tedious, as there are quite a few of these calls  (example in cli-text.patch)
> 
> 3.    Change pa_xstrdup to return an empty string if it's given a NULL 
> pointer.  While not an exact duplication of a NULL pointer, it would be much 
> cleaner, and more portable (example in xmalloc.patch)
> 
> I would recommend option 3, as it permanently adjusts the NULL strings before 
> they propogate anywhere.  There would be no need to correct any calls to 
> pa_strbuf_printf, provided that ONLY strings created from pa_xstrdup were 
> used.
> 

I'd say that is a wonderful way to get entirely confusing code. Calling
printf-esque functions with an invalid string is a bug and should be
dealt with accordingly. I.e. option 2 is the correct solution.

Rgds
-- 
Pierre Ossman            OpenSource-based Thin Client Technology
System Developer         Telephone: +46-13-21 46 00
Cendio AB                Web: http://www.cendio.com

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
pulseaudio-discuss mailing list
[email protected]
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss

Reply via email to