Re: [AD] [PATCH] Solaris Fixes and dev notes |
[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]
On 6/5/05, Elias Pschernig <elias@xxxxxxxxxxxxxxxxx > wrote:On Sun, 2005-06-05 at 01:07 -0500, Shawn Walker wrote:
> 2) In several key cases XKeysymToString was being used to directly
> pass arguments to other routines, without checking the return value
> first. This is bad. XKeysymToString can return NULL as a value. I only
> fixed the places that were causing Allegro to segfault for me, not all
> of them. I noted that the Allegro code was already checking this in
> some places, but not in others. This should be addressed.
>
NULL is fine in these cases, it is passed as parameter to printf as a %s
argument, which allows NULL pointers (It prints "(null)").
In my case NULL values were being passed as arguments to AL_TRACE, which in turn was passing them to vsprintf, vsprintf assumes that the string values you pass it are valid strings. As a result, I get a segfault when it attempts to call strlen on the string data that was passed in. So the changes are needed. I would bet that the (null) behaviour you see is not something that you can rely on across all platforms.
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |