Skip to content

Commit

Permalink
Fix: memory write out of bounds. (signal11#418)
Browse files Browse the repository at this point in the history
  • Loading branch information
MiroKaku authored May 25, 2022
1 parent 93285f5 commit 844e468
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions windows/hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -1081,7 +1081,7 @@ int HID_API_EXPORT_CALL HID_API_CALL hid_get_manufacturer_string(hid_device *dev
}

wcsncpy(string, dev->device_info->manufacturer_string, maxlen);
string[maxlen] = L'\0';
string[maxlen - 1] = L'\0';

return 0;
}
Expand All @@ -1102,7 +1102,7 @@ int HID_API_EXPORT_CALL HID_API_CALL hid_get_product_string(hid_device *dev, wch


wcsncpy(string, dev->device_info->product_string, maxlen);
string[maxlen] = L'\0';
string[maxlen - 1] = L'\0';

return 0;
}
Expand All @@ -1123,7 +1123,7 @@ int HID_API_EXPORT_CALL HID_API_CALL hid_get_serial_number_string(hid_device *de


wcsncpy(string, dev->device_info->serial_number, maxlen);
string[maxlen] = L'\0';
string[maxlen - 1] = L'\0';

return 0;
}
Expand Down

0 comments on commit 844e468

Please sign in to comment.