Skip to content

Do not use atoi() for number parsing in launchd mode

strlcpy() is not available on my Debian system and I want to compile this code. Thus, replace strlcpy() with strncpy() which is hopefully just as safe.

Signed-off-by: Uli Schlachter psychon@znc.in


Do not use atoi() for number parsing in launchd mode

The code in _xcb_parse_display_path_to_socket() is used in launchd mode (configure --with-launchd) to try to parse $DISPLAY. This code used atoi() to parse a number, which means that parse errors are silently ignored.

This commit fixes that by switching to strtoul() and checking that the whole string could be parsed and a number was really present. This also extends the existing unit tests with a case for this.

Related-to: https://github.com/quininer/x11-clipboard/issues/38 Signed-off-by: Uli Schlachter psychon@znc.in

Merge request reports

Loading