Hello,

I have not seen a discussion about this patch.
I think it is correct and should be applied.

Comments?

2013/7/10 Chris Dickens <christopher.a.dick...@gmail.com>:
> For messages received on the hotplug pipe, the message was read via
> usbi_read() (ssize_t) and compared against the size of the message
> struct (size_t). usbi_read() returns -1 on an error condition, so some
> systems can cast the ssize_t to size_t for the comparison, making it
> equal to SIZE_MAX and causing the error check condition to incorrectly
> evaluate to false.
> ---
>  libusb/io.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/libusb/io.c b/libusb/io.c
> index 4368b99..ead933d 100644
> --- a/libusb/io.c
> +++ b/libusb/io.c
> @@ -1995,9 +1995,9 @@ static int handle_events(struct libusb_context *ctx, 
> struct timeval *tv)
>                 usbi_dbg("caught a fish on the hotplug pipe");
>
>                 /* read the message from the hotplug thread */
> -               ret = usbi_read(ctx->hotplug_pipe[0], &message, sizeof 
> (message));
> -               if (ret < sizeof(message)) {
> -                       usbi_err(ctx, "hotplug pipe read error %d < %d",
> +               ret = usbi_read(ctx->hotplug_pipe[0], &message, 
> sizeof(message));
> +               if (ret != sizeof(message)) {
> +                       usbi_err(ctx, "hotplug pipe read error %d != %u",
>                                  ret, sizeof(message));
>                         r = LIBUSB_ERROR_OTHER;
>                         goto handled;
> --
> 1.7.6
>
>
> ------------------------------------------------------------------------------
> See everything from the browser to the database with AppDynamics
> Get end-to-end visibility with application monitoring from AppDynamics
> Isolate bottlenecks and diagnose root cause in seconds.
> Start your free trial of AppDynamics Pro today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
> _______________________________________________
> libusbx-devel mailing list
> libusbx-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/libusbx-devel



-- 
 Dr. Ludovic Rousseau

------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel

Reply via email to