On 02/17/13 10:32 AM, walter harms wrote:
>> @@ -190,7 +191,7 @@ XGetErrorDatabaseText(
>>      else
>>          tptr = Xmalloc (tlen);
>>      if (tptr) {
>> -        sprintf(tptr, "%s.%s", name, type);
>> +        snprintf(tptr, tlen, "%s.%s", name, type);
>>          XrmGetResource(db, tptr, "ErrorType.ErrorNumber",
>>            &type_str, &result);
>>          if (tptr != temp)
> 
> 
> perhaps an asprintf() is more nice here ?

If you look at the full context, it's only doing the malloc when the temporary
stack buffer it uses isn't large enough:

http://cgit.freedesktop.org/xorg/lib/libX11/tree/src/ErrDes.c#n185

Plus we don't have an asprintf fallback implementation in libX11 yet, and we
still support a number of older releases without asprintf in libc yet.

-- 
        -Alan Coopersmith-              [email protected]
         Oracle Solaris Engineering - http://blogs.oracle.com/alanc
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to