From: mpi Date: Sun, 18 Jan 2015 17:16:06 +0000 (+0000) Subject: Do not calculated the length of a report with an extra byte for the X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=4e4160e6db62cab6d3079af8e5b10a10fc367d4b;p=openbsd Do not calculated the length of a report with an extra byte for the reportID because the kernel skips it. Problem reported and fix tested by Benjamin Baier. --- diff --git a/lib/libusbhid/parse.c b/lib/libusbhid/parse.c index a0d3baa0814..06624eccd77 100644 --- a/lib/libusbhid/parse.c +++ b/lib/libusbhid/parse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.c,v 1.9 2014/05/12 17:03:28 mpi Exp $ */ +/* $OpenBSD: parse.c,v 1.10 2015/01/18 17:16:06 mpi Exp $ */ /* $NetBSD: parse.c,v 1.2 2001/12/29 20:44:22 augustss Exp $ */ /* @@ -541,8 +541,8 @@ hid_report_size(report_desc_t r, enum hid_kind k, int id) else temp = hpos - lpos; - /* return length in bytes rounded up */ - return ((temp + 7) / 8 + report_id); + /* No extra byte for the reportID because the kernel skips it. */ + return ((temp + 7) / 8); } int