[PATCH weston] rdp: Check for non-digits and errno in strtol call

Bryce Harrington bryce at osg.samsung.com
Tue Jul 12 21:25:41 UTC 2016


On Tue, Jul 12, 2016 at 08:12:37AM -0700, Yong Bakos wrote:
> On Jul 11, 2016, at 5:02 PM, Bryce Harrington <bryce at osg.samsung.com> wrote:
> > 
> > Improve error checking for situations like RDP_FD=42foo, or where the
> > provided number is out of range.
> > 
> > Suggestion by Yong Bakos.
> > 
> > Signed-off-by: Bryce Harrington <bryce at osg.samsung.com>
> 
> The condition addresses all failure cases, so this is
> Reviewed-by: Yong Bakos <ybakos at humanoriented.com>
> 
> yong

Thanks Yong and Eric, I've pushed with your R-b's:
   7fc000c..5ba41eb  master -> master


> > ---
> > libweston/compositor-rdp.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/libweston/compositor-rdp.c b/libweston/compositor-rdp.c
> > index 79f0687..53c7124 100644
> > --- a/libweston/compositor-rdp.c
> > +++ b/libweston/compositor-rdp.c
> > @@ -1263,7 +1263,8 @@ rdp_backend_create(struct weston_compositor *compositor,
> > 		}
> > 
> > 		fd = strtoul(fd_str, &fd_tail, 10);
> > -		if (fd_tail == fd_str || rdp_peer_init(freerdp_peer_new(fd), b))
> > +		if (errno != 0 || fd_tail == fd_str || *fd_tail != '\0'
> > +		    || rdp_peer_init(freerdp_peer_new(fd), b))
> > 			goto err_output;
> > 	}
> > 
> > -- 
> > 1.9.1
> > 
> > _______________________________________________
> > wayland-devel mailing list
> > wayland-devel at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list