summaryrefslogtreecommitdiff
path: root/libusb/os
diff options
context:
space:
mode:
authorPete Batard <pbatard@gmail.com>2010-08-21 01:29:36 +0100
committerPete Batard <pbatard@gmail.com>2010-08-21 01:29:36 +0100
commit5006604a96db602924bd425dcf2665de9b4f35bf (patch)
tree3063fadb3e2169b9c1e7dc76ede940a701b97a9f /libusb/os
parent34582d44ac0f1382be4021eb634ade10badaf62d (diff)
downloadlibusb-5006604a96db602924bd425dcf2665de9b4f35bf.tar.gz
workaround for unavailable _strdup on MinGW32pbr300
Diffstat (limited to 'libusb/os')
-rw-r--r--libusb/os/windows_usb.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libusb/os/windows_usb.c b/libusb/os/windows_usb.c
index e15d158..777b2b4 100644
--- a/libusb/os/windows_usb.c
+++ b/libusb/os/windows_usb.c
@@ -429,8 +429,13 @@ bool is_api_driver(char* driver, uint8_t api)
{
uint8_t i;
const char sep_str[2] = {LIST_SEPARATOR, 0};
- char *tok, *tmp_str = _strdup(driver);
+ char *tok, *tmp_str;
+ size_t len = safe_strlen(driver);
+
+ if (len == 0) return false;
+ tmp_str = calloc(len+1, 1);
if (tmp_str == NULL) return false;
+ memcpy(tmp_str, driver, len+1);
tok = strtok(tmp_str, sep_str);
while (tok != NULL) {
for (i=0; i<usb_api_backend[api].nb_driver_names; i++) {