Re: ihidev: fix possible panic

2019-04-08 Thread Stefan Sperling
On Mon, Apr 08, 2019 at 09:49:37AM -0500, joshua stein wrote: > psize is built from the first two bytes read from the device, but it > could be completely bogus, especially when polling. This can result > in a panic when reading p. > > Promote it to a signed int to catch it going negative and d

ihidev: fix possible panic

2019-04-08 Thread joshua stein
psize is built from the first two bytes read from the device, but it could be completely bogus, especially when polling. This can result in a panic when reading p. Promote it to a signed int to catch it going negative and discard it if it's 2 or less, because shortly after it is decreased by 2