mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2026-03-09 05:34:31 -04:00
scanner, client: Added more error checks when strtol function is used
Signed-off-by: Imran Zaman <imran.zaman@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This commit is contained in:
parent
ba6b79c577
commit
ff769d8fae
2 changed files with 7 additions and 2 deletions
|
|
@ -829,9 +829,12 @@ wl_display_connect(const char *name)
|
|||
|
||||
connection = getenv("WAYLAND_SOCKET");
|
||||
if (connection) {
|
||||
int prev_errno = errno;
|
||||
errno = 0;
|
||||
fd = strtol(connection, &end, 0);
|
||||
if (*end != '\0')
|
||||
if (errno != 0 || connection == end || *end != '\0')
|
||||
return NULL;
|
||||
errno = prev_errno;
|
||||
|
||||
flags = fcntl(fd, F_GETFD);
|
||||
if (flags != -1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue