forked from nuttx/nuttx-update
drivers/usbhost/hid_parser.c: Fix out of range array accesses
Found by clang-check: usbhost/hid_parser.c:278:26: warning: Assigned value is garbage or undefined usage[i] = usage[i + 1]; ^ ~~~~~~~~~~~~ usbhost/hid_parser.c:321:34: warning: Assigned value is garbage or undefined usage[i] = usage[i + 1]; ^ ~~~~~~~~~~~~ 2 warnings generated.
This commit is contained in:
parent
4f7745ae1c
commit
59ba52aee8
1 changed files with 4 additions and 4 deletions
|
@ -274,8 +274,8 @@ int hid_parsereport(FAR const uint8_t *report, int rptlen,
|
|||
{
|
||||
collectionpath->usage.usage = usage[0];
|
||||
|
||||
for (i = 0; i < nusage; i++)
|
||||
usage[i] = usage[i + 1];
|
||||
for (i = 1; i < nusage; i++)
|
||||
usage[i - 1] = usage[i];
|
||||
|
||||
nusage--;
|
||||
}
|
||||
|
@ -316,9 +316,9 @@ int hid_parsereport(FAR const uint8_t *report, int rptlen,
|
|||
{
|
||||
newitem.attrib.usage.usage = usage[0];
|
||||
|
||||
for (i = 0; i < nusage; i++)
|
||||
for (i = 1; i < nusage; i++)
|
||||
{
|
||||
usage[i] = usage[i + 1];
|
||||
usage[i - 1] = usage[i];
|
||||
}
|
||||
nusage--;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue