On 17 November 2016 at 11:35, Daniel Stone <[email protected]> wrote:
> The X11 lock file was somewhat opaque. Into a sized array of 16
> characters, we previously read 11 bytes. 61beda653b fixed the parsing of
> this input to ensure that we only considered the first 10 bytes: this
> has the effect of culling a LF byte at the end of the string.
>
> This commit more explicitly NULLs the entire string before reading, and
> trims trailing LF characters only.
>
> It also adds some documentation by way of resizing pid, an explicit size
> check on snprintf's return, and comments.
>
> Related Mutter issue: https://bugzilla.gnome.org/show_bug.cgi?id=774613

For those of you playing along at home, this meant that before Pekka's
patch, Weston would fail to parse its own lock files and Xorg's, as
the trailing \n made safe_strtol explode. It would, however, parse
Mutter's lock files, because Mutter was off by one in snprintf and
would thus print "%10d\0" to the file instead of the "%10d\n". Great
stuff.

Cheers,
Daniel
_______________________________________________
wayland-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to