[PATCH v3] wayland-util: added wl_strtol/wl_strtoul utility functions

Bill Spitzak spitzak at gmail.com
Mon Oct 27 11:29:55 PDT 2014

On 10/27/2014 09:51 AM, Jasper St. Pierre wrote:

>         +                       if (!wl_strtol(since, NULL, 0, (long
>         *)&version))
>     This is baad. You cannot use the int version here, because in
>     wl_strol you write sizeof(long) on the address
>     of version and if sizeof(version) is smaller than sizeof(long) then
>     you overwrite memory. I'm getting ugly SIGSEGV
>     because of that.

That is annoying since it means an integer version must be provided as 
well (plus the annoyance that on some platforms it will not complain and 
work if you call the wrong function).

I think it would be better now to make this function return the value, 
and set errno on any error. Or make the error indicator an output 
parameter. I'd also dump the "base" parameter as it is not being used by 

More information about the wayland-devel mailing list