Date: Fri, 1 May 2009 11:06:55 +0000 From: Sylvestre Gallon <ccna.syl@gmail.com> To: Hans Petter Selasky <hselasky@c2i.net> Cc: Perforce Change Reviews <perforce@freebsd.org> Subject: Re: PERFORCE change 161423 for review Message-ID: <164b4c9c0905010406s46caf7f1m6fb01b1969f98d41@mail.gmail.com> In-Reply-To: <200905011224.03899.hselasky@c2i.net> References: <200905010921.n419LL8L097778@repoman.freebsd.org> <200905011224.03899.hselasky@c2i.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, May 1, 2009 at 10:24 AM, Hans Petter Selasky <hselasky@c2i.net> wrote: >> int >> libusb_get_string_descriptor_ascii(libusb_device_handle * dev, >> uint8_t desc_index, unsigned char *data, int length) >> @@ -207,6 +208,8 @@ >> return (LIBUSB20_ERROR_NO_MEM); >> >> pdev = dev->os_priv; >> - return (libusb20_dev_req_string_simple_sync(pdev, desc_index, >> - data, length)); >> + if (libusb20_dev_req_string_simple_sync(pdev, desc_index, >> + data, length) == 0) >> + return (length); >> + return (LIBUSB_ERROR_OTHER); >> } > > I think the correct here is to return strlen(data) in the successful case, > because it is quite common that the software will pass in a fixed size > buffer, while the actual string will be shorter. > > In other words you will get a short terminated control request on the USB. > I will add your fix with my next submit. Thanks, -- Sylvestre Gallon (http://devsyl.blogspot.com) Fifth Grade Student @ Epitech & Researcher @ LSE R&D @ Rathaxes (http://www.rathaxes.org)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?164b4c9c0905010406s46caf7f1m6fb01b1969f98d41>