hidapi, windows: replace a strncpy() with plain memcpy()

mainstream has a similar change, already.
This commit is contained in:
Ozkan Sezer 2021-11-30 21:10:10 +03:00
parent 5fc901d4f3
commit 09465a9083

View file

@ -53,7 +53,6 @@ typedef LONG NTSTATUS;
#define memset SDL_memset
#define strcmp SDL_strcmp
#define strlen SDL_strlen
#define strncpy SDL_strlcpy
#define strstr SDL_strstr
#define strtol SDL_strtol
#define wcscmp SDL_wcscmp
@ -105,9 +104,6 @@ extern "C" {
#define MIN(x,y) ((x) < (y)? (x): (y))
#ifdef _MSC_VER
/* Thanks Microsoft, but I know how to use strncpy(). */
#pragma warning(disable:4996)
/* Yes, we have some unreferenced formal parameters */
#pragma warning(disable:4100)
#endif
@ -550,8 +546,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, len+1);
cur_dev->path[len] = '\0';
memcpy(cur_dev->path, str, len+1);
}
else
cur_dev->path = NULL;