mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2025-12-25 15:20:11 +01:00
rdp: Check for non-numeric value in RDP_FD env var
strtoul(nptr, endptr, ...) will set *endptr to nptr in the case of where no digits were read from the string, and return 0. Running with RDP_FD=foo would thus result in fd=0 being specified to freerdp_peer_new(), which is unlikely to be the user's intent. Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
This commit is contained in:
parent
9c09fe70c7
commit
bac72b29f8
1 changed files with 3 additions and 2 deletions
|
|
@ -1209,6 +1209,7 @@ rdp_backend_create(struct weston_compositor *compositor,
|
|||
{
|
||||
struct rdp_backend *b;
|
||||
char *fd_str;
|
||||
char *fd_tail;
|
||||
int fd;
|
||||
|
||||
b = zalloc(sizeof *b);
|
||||
|
|
@ -1261,8 +1262,8 @@ rdp_backend_create(struct weston_compositor *compositor,
|
|||
goto err_output;
|
||||
}
|
||||
|
||||
fd = strtoul(fd_str, NULL, 10);
|
||||
if (rdp_peer_init(freerdp_peer_new(fd), b))
|
||||
fd = strtoul(fd_str, &fd_tail, 10);
|
||||
if (fd_tail == fd_str || rdp_peer_init(freerdp_peer_new(fd), b))
|
||||
goto err_output;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue