descriptor.c: Fix buffer read overflow caught by valgrind
authorVitali Lovich <vlovich@aliph.com>
Thu, 17 Mar 2011 00:33:57 +0000 (17:33 -0700)
committerPeter Stuge <peter@stuge.se>
Sun, 24 Jul 2011 20:29:09 +0000 (22:29 +0200)
commit9479ce9dae3d0dbe2ce693bd02ccceb018a75fe9
tree14020257bc4c34a89ca08a6a423440dde120eb9d
parentc775c2f43037cd235b65410583179195e25f9c4a
descriptor.c: Fix buffer read overflow caught by valgrind

In parse_interface() an unexpected descriptor would be parsed without
validating the descriptor's length.  It is possible for size to be 0 at
this point, which means that the parsing would read past the end of the
source buffer.  Fix #83 by checking the length of the remaining buffer
before parsing.
libusb/descriptor.c