Skip to content

Commit

Permalink
Revert back to correct Windows behavior, fixes #7 (#8)
Browse files Browse the repository at this point in the history
* revert back to previous behaviour, fixes #7

* hide gcc warning about strncopy overflow
  • Loading branch information
holiman authored and karalabe committed Sep 19, 2019
1 parent 550797b commit 51dc0ef
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion hidapi/windows/hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ extern "C" {
#pragma warning(disable:4996)
#endif

#pragma GCC diagnostic ignored "-Wstringop-overflow"

#ifdef __cplusplus
extern "C" {
#endif
Expand Down Expand Up @@ -428,7 +430,7 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor
if (str) {
len = strlen(str);
cur_dev->path = (char*) calloc(len+1, sizeof(char));
strncpy(cur_dev->path, str, sizeof(cur_dev->path));
strncpy(cur_dev->path, str, len+1);
cur_dev->path[len] = '\0';
}
else
Expand Down

0 comments on commit 51dc0ef

Please sign in to comment.