Flawfinder version 2.0.10, (C) 2001-2019 David A. Wheeler. Number of rules (primarily dangerous function names) in C/C++ ruleset: 223 Examining data/libusb-1.0-1.0.23/examples/getopt/getopt.c Examining data/libusb-1.0-1.0.23/examples/getopt/getopt1.c Examining data/libusb-1.0-1.0.23/examples/getopt/getopt.h Examining data/libusb-1.0-1.0.23/examples/dpfp.c Examining data/libusb-1.0-1.0.23/examples/dpfp_threaded.c Examining data/libusb-1.0-1.0.23/examples/ezusb.c Examining data/libusb-1.0-1.0.23/examples/ezusb.h Examining data/libusb-1.0-1.0.23/examples/fxload.c Examining data/libusb-1.0-1.0.23/examples/hotplugtest.c Examining data/libusb-1.0-1.0.23/examples/listdevs.c Examining data/libusb-1.0-1.0.23/examples/sam3u_benchmark.c Examining data/libusb-1.0-1.0.23/examples/testlibusb.c Examining data/libusb-1.0-1.0.23/examples/xusb.c Examining data/libusb-1.0-1.0.23/libusb/version.h Examining data/libusb-1.0-1.0.23/libusb/version_nano.h Examining data/libusb-1.0-1.0.23/libusb/os/poll_posix.h Examining data/libusb-1.0-1.0.23/libusb/os/poll_posix.c Examining data/libusb-1.0-1.0.23/libusb/os/poll_windows.h Examining data/libusb-1.0-1.0.23/libusb/os/poll_windows.c Examining data/libusb-1.0-1.0.23/libusb/os/threads_windows.h Examining data/libusb-1.0-1.0.23/libusb/os/threads_windows.c Examining data/libusb-1.0-1.0.23/libusb/os/threads_posix.h Examining data/libusb-1.0-1.0.23/libusb/os/threads_posix.c Examining data/libusb-1.0-1.0.23/libusb/os/darwin_usb.h Examining data/libusb-1.0-1.0.23/libusb/os/darwin_usb.c Examining data/libusb-1.0-1.0.23/libusb/os/linux_usbfs.h Examining data/libusb-1.0-1.0.23/libusb/os/linux_usbfs.c Examining data/libusb-1.0-1.0.23/libusb/os/linux_netlink.c Examining data/libusb-1.0-1.0.23/libusb/os/linux_udev.c Examining data/libusb-1.0-1.0.23/libusb/os/netbsd_usb.c Examining data/libusb-1.0-1.0.23/libusb/os/openbsd_usb.c Examining data/libusb-1.0-1.0.23/libusb/os/sunos_usb.c Examining data/libusb-1.0-1.0.23/libusb/os/sunos_usb.h Examining data/libusb-1.0-1.0.23/libusb/os/windows_common.h Examining data/libusb-1.0-1.0.23/libusb/os/windows_nt_common.h Examining data/libusb-1.0-1.0.23/libusb/os/windows_nt_common.c Examining data/libusb-1.0-1.0.23/libusb/os/windows_nt_shared_types.h Examining data/libusb-1.0-1.0.23/libusb/os/windows_usbdk.h Examining data/libusb-1.0-1.0.23/libusb/os/windows_usbdk.c Examining data/libusb-1.0-1.0.23/libusb/os/windows_winusb.h Examining data/libusb-1.0-1.0.23/libusb/os/windows_winusb.c Examining data/libusb-1.0-1.0.23/libusb/os/haiku_usb.h Examining data/libusb-1.0-1.0.23/libusb/os/haiku_usb_backend.cpp Examining data/libusb-1.0-1.0.23/libusb/os/haiku_usb_raw.h Examining data/libusb-1.0-1.0.23/libusb/os/haiku_usb_raw.cpp Examining data/libusb-1.0-1.0.23/libusb/os/haiku_pollfs.cpp Examining data/libusb-1.0-1.0.23/libusb/os/wince_usb.h Examining data/libusb-1.0-1.0.23/libusb/os/wince_usb.c Examining data/libusb-1.0-1.0.23/libusb/os/null_usb.c Examining data/libusb-1.0-1.0.23/libusb/core.c Examining data/libusb-1.0-1.0.23/libusb/descriptor.c Examining data/libusb-1.0-1.0.23/libusb/hotplug.h Examining data/libusb-1.0-1.0.23/libusb/hotplug.c Examining data/libusb-1.0-1.0.23/libusb/io.c Examining data/libusb-1.0-1.0.23/libusb/strerror.c Examining data/libusb-1.0-1.0.23/libusb/sync.c Examining data/libusb-1.0-1.0.23/libusb/libusbi.h Examining data/libusb-1.0-1.0.23/libusb/libusb.h Examining data/libusb-1.0-1.0.23/msvc/missing.c Examining data/libusb-1.0-1.0.23/msvc/missing.h Examining data/libusb-1.0-1.0.23/msvc/stdint.h Examining data/libusb-1.0-1.0.23/msvc/inttypes.h Examining data/libusb-1.0-1.0.23/msvc/config.h Examining data/libusb-1.0-1.0.23/msvc/errno.h Examining data/libusb-1.0-1.0.23/android/config.h Examining data/libusb-1.0-1.0.23/Xcode/config.h Examining data/libusb-1.0-1.0.23/tests/stress.c Examining data/libusb-1.0-1.0.23/tests/libusb_testlib.h Examining data/libusb-1.0-1.0.23/tests/testlib.c FINAL RESULTS: data/libusb-1.0-1.0.23/libusb/core.c:2519:6: [5] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). Risk is high, it appears that the size is given as bytes, but the function requires size as characters. if (MultiByteToWideChar(CP_UTF8, 0, str, -1, wbuf, sizeof(wbuf)) != 0) data/libusb-1.0-1.0.23/libusb/os/linux_usbfs.c:710:8: [5] (race) readlink: This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach. r = readlink(proc_path, fd_path, PATH_MAX); data/libusb-1.0-1.0.23/examples/ezusb.c:33:25: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. __attribute__ ((format(printf, 1, 2))); data/libusb-1.0-1.0.23/examples/fxload.c:63:3: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, format, ap); data/libusb-1.0-1.0.23/examples/testlibusb.c:25:9: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. #define snprintf _snprintf data/libusb-1.0-1.0.23/examples/testlibusb.c:25:18: [4] (format) _snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. #define snprintf _snprintf data/libusb-1.0-1.0.23/examples/xusb.c:37:9: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. #define snprintf _snprintf data/libusb-1.0-1.0.23/examples/xusb.c:37:18: [4] (format) _snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. #define snprintf _snprintf data/libusb-1.0-1.0.23/examples/xusb.c:66:2: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, format, args); data/libusb-1.0-1.0.23/libusb/core.c:2638:13: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. text_len = vsnprintf(buf + header_len, sizeof(buf) - (size_t)header_len, data/libusb-1.0-1.0.23/libusb/core.c:2649:2: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(buf + header_len + text_len, USBI_LOG_LINE_END); data/libusb-1.0-1.0.23/libusb/libusbi.h:223:9: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. #define snprintf usbi_snprintf data/libusb-1.0-1.0.23/libusb/libusbi.h:224:9: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. #define vsnprintf usbi_vsnprintf data/libusb-1.0-1.0.23/libusb/os/openbsd_usb.c:145:3: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf(busnode, sizeof(busnode), USBDEV "%d", i); data/libusb-1.0-1.0.23/libusb/os/openbsd_usb.c:239:3: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf(devnode, sizeof(devnode), DEVPATH "%s.00", data/libusb-1.0-1.0.23/libusb/os/openbsd_usb.c:686:3: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf(devnode, sizeof(devnode), DEVPATH "%s.%02d", data/libusb-1.0-1.0.23/libusb/os/openbsd_usb.c:746:2: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf(busnode, sizeof(busnode), USBDEV "%d", number); data/libusb-1.0-1.0.23/libusb/os/sunos_usb.c:343:3: [4] (shell) execv: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. execv(path, argv_list); data/libusb-1.0-1.0.23/libusb/os/sunos_usb.c:418:6: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access(dpriv->ugenpath, F_OK) == -1) { data/libusb-1.0-1.0.23/libusb/os/windows_winusb.c:169:2: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(&ret_path[add_root], path); data/libusb-1.0-1.0.23/tests/testlib.c:157:2: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(ctx->output_file, fmt, va); data/libusb-1.0-1.0.23/examples/fxload.c:87:28: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char *device_path = getenv("DEVICE"); data/libusb-1.0-1.0.23/examples/fxload.c:100:16: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((opt = getopt(argc, argv, "qvV?hd:p:i:I:s:S:t:")) != EOF) data/libusb-1.0-1.0.23/examples/getopt/getopt.c:211:9: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. #ifndef getenv data/libusb-1.0-1.0.23/examples/getopt/getopt.c:216:14: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. extern char *getenv (); data/libusb-1.0-1.0.23/examples/getopt/getopt.c:402:21: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. posixly_correct = getenv ("POSIXLY_CORRECT"); data/libusb-1.0-1.0.23/examples/getopt/getopt.c:977:1: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. getopt (argc, argv, optstring) data/libusb-1.0-1.0.23/examples/getopt/getopt.c:1007:11: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. c = getopt (argc, argv, "abc:d:0123456789"); data/libusb-1.0-1.0.23/examples/getopt/getopt.h:145:12: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. extern int getopt (int __argc, char *const *__argv, const char *__shortopts); data/libusb-1.0-1.0.23/examples/getopt/getopt.h:147:12: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. extern int getopt (); data/libusb-1.0-1.0.23/examples/getopt/getopt.h:151:12: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts, data/libusb-1.0-1.0.23/examples/getopt/getopt.h:164:12: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. extern int getopt (); data/libusb-1.0-1.0.23/examples/getopt/getopt.h:166:12: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. extern int getopt_long (); data/libusb-1.0-1.0.23/examples/getopt/getopt1.c:67:1: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. getopt_long (argc, argv, options, long_options, opt_index) data/libusb-1.0-1.0.23/examples/getopt/getopt1.c:123:11: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. c = getopt_long (argc, argv, "abc:d:0123456789", data/libusb-1.0-1.0.23/examples/xusb.c:1104:16: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. old_dbg_str = getenv("LIBUSB_DEBUG"); data/libusb-1.0-1.0.23/libusb/core.c:2227:20: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char *dbg = getenv("LIBUSB_DEBUG"); data/libusb-1.0-1.0.23/libusb/os/sunos_usb.c:1175:6: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if (getenv("LIBUSB_DEBUG") == NULL) { data/libusb-1.0-1.0.23/libusb/os/threads_windows.c:71:2: [3] (misc) EnterCriticalSection: On some versions of Windows, exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. EnterCriticalSection(mutex); data/libusb-1.0-1.0.23/libusb/os/threads_windows.h:39:2: [3] (misc) InitializeCriticalSection: Exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. InitializeCriticalSection(mutex); data/libusb-1.0-1.0.23/libusb/os/threads_windows.h:44:2: [3] (misc) EnterCriticalSection: On some versions of Windows, exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. EnterCriticalSection(mutex); data/libusb-1.0-1.0.23/libusb/os/windows_common.h:65:32: [3] (misc) LoadLibrary: Ensure that the full path to the library is specified, or current directory may be used (CWE-829, CWE-20). Use registry entry or GetWindowsDirectory to find library path, if you aren't already. #define DLL_LOAD_LIBRARY(name) LoadLibrary(DLL_STRINGIFY(name)) data/libusb-1.0-1.0.23/msvc/missing.c:32:7: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char *getenv(const char *name) data/libusb-1.0-1.0.23/msvc/missing.h:30:7: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char *getenv(const char *name); data/libusb-1.0-1.0.23/examples/dpfp.c:61:17: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static unsigned char imgbuf[0x1b340]; data/libusb-1.0-1.0.23/examples/dpfp.c:62:17: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static unsigned char irqbuf[INTR_LENGTH]; data/libusb-1.0-1.0.23/examples/dpfp.c:76:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char data[0x10]; data/libusb-1.0-1.0.23/examples/dpfp.c:213:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char data[INTR_LENGTH]; data/libusb-1.0-1.0.23/examples/dpfp.c:227:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char filename[64]; data/libusb-1.0-1.0.23/examples/dpfp.c:230:7: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = fopen(filename, "w"); data/libusb-1.0-1.0.23/examples/dpfp_threaded.c:66:17: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static unsigned char imgbuf[0x1b340]; data/libusb-1.0-1.0.23/examples/dpfp_threaded.c:67:17: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static unsigned char irqbuf[INTR_LENGTH]; data/libusb-1.0-1.0.23/examples/dpfp_threaded.c:110:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char data[0x10]; data/libusb-1.0-1.0.23/examples/dpfp_threaded.c:247:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char data[INTR_LENGTH]; data/libusb-1.0-1.0.23/examples/dpfp_threaded.c:261:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char filename[64]; data/libusb-1.0-1.0.23/examples/dpfp_threaded.c:264:7: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = fopen(filename, "w"); data/libusb-1.0-1.0.23/examples/ezusb.c:247:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char data[1023]; data/libusb-1.0-1.0.23/examples/ezusb.c:265:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[512], *cp; data/libusb-1.0-1.0.23/examples/ezusb.c:395:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char data[4096]; data/libusb-1.0-1.0.23/examples/ezusb.c:433:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char data[4096]; data/libusb-1.0-1.0.23/examples/ezusb.c:570:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char *bBuf, hBuf[4], blBuf[4], rBuf[4096]; data/libusb-1.0-1.0.23/examples/ezusb.c:574:10: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). image = fopen(path, "rb"); data/libusb-1.0-1.0.23/examples/ezusb.c:731:10: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). image = fopen(path, "rb"); data/libusb-1.0-1.0.23/examples/fxload.c:89:8: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. const char *fx_name[FX_TYPE_MAX] = FX_TYPE_NAMES; data/libusb-1.0-1.0.23/examples/testlibusb.c:172:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char description[260]; data/libusb-1.0-1.0.23/examples/testlibusb.c:173:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char string[256]; data/libusb-1.0-1.0.23/examples/xusb.c:184:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char uuid_string[40]; data/libusb-1.0-1.0.23/examples/xusb.c:357:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(cbw.CBWCB, cdb, cdb_len); data/libusb-1.0-1.0.23/examples/xusb.c:469:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char vid[9], pid[9], rev[5]; data/libusb-1.0-1.0.23/examples/xusb.c:547:31: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((binary_dump) && ((fd = fopen(binary_name, "w")) != NULL)) { data/libusb-1.0-1.0.23/examples/xusb.c:629:30: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((binary_dump) && ((fd = fopen(binary_name, "w")) != NULL)) { data/libusb-1.0-1.0.23/examples/xusb.c:815:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char string[128]; data/libusb-1.0-1.0.23/libusb/core.c:1353:19: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). r = usbi_backend.open(_dev_handle); data/libusb-1.0-1.0.23/libusb/core.c:2230:19: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). int dbg_level = atoi(dbg); data/libusb-1.0-1.0.23/libusb/core.c:2560:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[USBI_MAX_LOG_LEN]; data/libusb-1.0-1.0.23/libusb/descriptor.c:63:6: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(dp, sp, 2); data/libusb-1.0-1.0.23/libusb/descriptor.c:75:6: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(dp, sp, 4); data/libusb-1.0-1.0.23/libusb/descriptor.c:85:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(dp, sp, 16); data/libusb-1.0-1.0.23/libusb/descriptor.c:184:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(extra, begin, len); data/libusb-1.0-1.0.23/libusb/descriptor.c:316:4: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy((unsigned char *) ifp->extra, begin, len); data/libusb-1.0-1.0.23/libusb/descriptor.c:465:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy((unsigned char *) config->extra, begin, len); data/libusb-1.0-1.0.23/libusb/descriptor.c:547:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy((unsigned char *) desc, (unsigned char *) &dev->device_descriptor, data/libusb-1.0-1.0.23/libusb/descriptor.c:570:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char tmp[LIBUSB_DT_CONFIG_SIZE]; data/libusb-1.0-1.0.23/libusb/descriptor.c:619:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char tmp[LIBUSB_DT_CONFIG_SIZE]; data/libusb-1.0-1.0.23/libusb/descriptor.c:664:12: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char tmp[6]; data/libusb-1.0-1.0.23/libusb/descriptor.c:873:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(_bos->dev_capability[i], buffer, dev_cap.bLength); data/libusb-1.0-1.0.23/libusb/descriptor.c:1144:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char tbuf[255]; /* Some devices choke on size > 255 */ data/libusb-1.0-1.0.23/libusb/libusbi.h:390:23: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. PTR_ALIGNED unsigned char os_priv[ZERO_SIZED_ARRAY]; data/libusb-1.0-1.0.23/libusb/libusbi.h:446:23: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. PTR_ALIGNED unsigned char os_priv[ZERO_SIZED_ARRAY]; data/libusb-1.0-1.0.23/libusb/libusbi.h:458:23: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. PTR_ALIGNED unsigned char os_priv[ZERO_SIZED_ARRAY]; data/libusb-1.0-1.0.23/libusb/libusbi.h:774:8: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). int (*open)(struct libusb_device_handle *dev_handle); data/libusb-1.0-1.0.23/libusb/os/darwin_usb.c:112:10: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char string_buffer[50]; data/libusb-1.0-1.0.23/libusb/os/darwin_usb.c:1651:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy (cached_configurations + i, cached_configuration, sizeof (cached_configurations[i])); data/libusb-1.0-1.0.23/libusb/os/darwin_usb.h:162:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char sys_path[21]; data/libusb-1.0-1.0.23/libusb/os/haiku_usb_backend.cpp:230:11: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fRawFD = open(dev->Location(), O_RDWR | O_CLOEXEC); data/libusb-1.0-1.0.23/libusb/os/haiku_usb_backend.cpp:452:15: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). int fRawFD = open(fPath, O_RDWR | O_CLOEXEC); data/libusb-1.0-1.0.23/libusb/os/haiku_usb_backend.cpp:463:57: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. fConfigurationDescriptors = new(std::nothrow) unsigned char *[fDeviceDescriptor.num_configurations]; data/libusb-1.0-1.0.23/libusb/os/haiku_usb_raw.cpp:80:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buffer, dev->Descriptor(), DEVICE_DESC_LENGTH); data/libusb-1.0-1.0.23/libusb/os/haiku_usb_raw.cpp:104:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buffer, config, len); data/libusb-1.0-1.0.23/libusb/os/linux_netlink.c:297:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char cred_buffer[CMSG_SPACE(sizeof(struct ucred))]; data/libusb-1.0-1.0.23/libusb/os/linux_netlink.c:298:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char msg_buffer[2048]; data/libusb-1.0-1.0.23/libusb/os/linux_usbfs.c:207:10: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). return open(path, flags | O_CLOEXEC); data/libusb-1.0-1.0.23/libusb/os/linux_usbfs.c:210:10: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). return open(path, flags); data/libusb-1.0-1.0.23/libusb/os/linux_usbfs.c:216:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char path[PATH_MAX]; data/libusb-1.0-1.0.23/libusb/os/linux_usbfs.c:584:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char filename[PATH_MAX]; data/libusb-1.0-1.0.23/libusb/os/linux_usbfs.c:603:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char filename[PATH_MAX]; data/libusb-1.0-1.0.23/libusb/os/linux_usbfs.c:647:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buffer, priv->descriptors, DEVICE_DESC_LENGTH); data/libusb-1.0-1.0.23/libusb/os/linux_usbfs.c:656:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char tmp[5] = {0, 0, 0, 0, 0}; data/libusb-1.0-1.0.23/libusb/os/linux_usbfs.c:699:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char proc_path[PATH_MAX], fd_path[PATH_MAX]; data/libusb-1.0-1.0.23/libusb/os/linux_usbfs.c:889:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buffer, config_desc, len); data/libusb-1.0-1.0.23/libusb/os/linux_usbfs.c:919:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buffer, descriptors, len); data/libusb-1.0-1.0.23/libusb/os/linux_usbfs.c:1103:29: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). dev->port_number = atoi(tmp + 1); data/libusb-1.0-1.0.23/libusb/os/linux_usbfs.c:1234:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char dirpath[PATH_MAX]; data/libusb-1.0-1.0.23/libusb/os/linux_usbfs.c:1254:13: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). devaddr = atoi(entry->d_name); data/libusb-1.0-1.0.23/libusb/os/linux_usbfs.c:1300:13: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). busnum = atoi(entry->d_name); data/libusb-1.0-1.0.23/libusb/os/linux_usbfs.c:1692:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(streams->eps, endpoints, num_endpoints); data/libusb-1.0-1.0.23/libusb/os/linux_usbfs.c:1849:2: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. strcpy(dc.driver, "usbfs"); data/libusb-1.0-1.0.23/libusb/os/linux_usbfs.h:62:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char driver[USBFS_MAXDRIVERNAME + 1]; data/libusb-1.0-1.0.23/libusb/os/linux_usbfs.h:122:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char port[127]; /* port to device num mapping */ data/libusb-1.0-1.0.23/libusb/os/linux_usbfs.h:137:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char driver[USBFS_MAXDRIVERNAME + 1]; data/libusb-1.0-1.0.23/libusb/os/linux_usbfs.h:143:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char eps[0]; data/libusb-1.0-1.0.23/libusb/os/netbsd_usb.c:36:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char devnode[16]; data/libusb-1.0-1.0.23/libusb/os/netbsd_usb.c:149:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char devnode[16]; data/libusb-1.0-1.0.23/libusb/os/netbsd_usb.c:159:13: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((fd = open(devnode, O_RDONLY)) < 0) { data/libusb-1.0-1.0.23/libusb/os/netbsd_usb.c:221:14: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). dpriv->fd = open(dpriv->devnode, O_RDWR); data/libusb-1.0-1.0.23/libusb/os/netbsd_usb.c:223:15: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). dpriv->fd = open(dpriv->devnode, O_RDONLY); data/libusb-1.0-1.0.23/libusb/os/netbsd_usb.c:255:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buf, &dpriv->ddesc, DEVICE_DESC_LENGTH); data/libusb-1.0-1.0.23/libusb/os/netbsd_usb.c:274:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buf, dpriv->cdesc, len); data/libusb-1.0-1.0.23/libusb/os/netbsd_usb.c:295:8: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open(dpriv->devnode, O_RDONLY); data/libusb-1.0-1.0.23/libusb/os/netbsd_usb.c:619:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char *s, devnode[16]; data/libusb-1.0-1.0.23/libusb/os/netbsd_usb.c:638:14: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if (((fd = open(devnode, O_RDWR)) < 0) && (errno == ENXIO)) data/libusb-1.0-1.0.23/libusb/os/netbsd_usb.c:639:14: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((fd = open(devnode, mode)) < 0) data/libusb-1.0-1.0.23/libusb/os/openbsd_usb.c:137:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char devices[USB_MAX_DEVICES]; data/libusb-1.0-1.0.23/libusb/os/openbsd_usb.c:138:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char busnode[16]; data/libusb-1.0-1.0.23/libusb/os/openbsd_usb.c:147:13: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((fd = open(busnode, O_RDWR)) < 0) { data/libusb-1.0-1.0.23/libusb/os/openbsd_usb.c:232:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char devnode[16]; data/libusb-1.0-1.0.23/libusb/os/openbsd_usb.c:241:15: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). dpriv->fd = open(devnode, O_RDWR); data/libusb-1.0-1.0.23/libusb/os/openbsd_usb.c:272:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buf, &dpriv->ddesc, DEVICE_DESC_LENGTH); data/libusb-1.0-1.0.23/libusb/os/openbsd_usb.c:290:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buf, dpriv->cdesc, len); data/libusb-1.0-1.0.23/libusb/os/openbsd_usb.c:672:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char devnode[16]; data/libusb-1.0-1.0.23/libusb/os/openbsd_usb.c:690:14: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if (((fd = open(devnode, O_RDWR)) < 0) && (errno == ENXIO)) data/libusb-1.0-1.0.23/libusb/os/openbsd_usb.c:691:14: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((fd = open(devnode, mode)) < 0) data/libusb-1.0-1.0.23/libusb/os/openbsd_usb.c:744:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char busnode[16]; data/libusb-1.0-1.0.23/libusb/os/openbsd_usb.c:748:9: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). return open(busnode, O_RDWR); data/libusb-1.0-1.0.23/libusb/os/sunos_usb.c:157:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char path_arg[PATH_MAX]; data/libusb-1.0-1.0.23/libusb/os/sunos_usb.c:185:7: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open(path_arg, O_RDONLY); data/libusb-1.0-1.0.23/libusb/os/sunos_usb.c:378:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char path_arg[PATH_MAX]; data/libusb-1.0-1.0.23/libusb/os/sunos_usb.c:432:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char path_arg[PATH_MAX]; data/libusb-1.0-1.0.23/libusb/os/sunos_usb.c:484:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char match_str[PATH_MAX]; data/libusb-1.0-1.0.23/libusb/os/sunos_usb.c:495:2: [2] (buffer) bcopy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. bcopy(descr, &dpriv->dev_descr, LIBUSB_DT_DEVICE_SIZE); data/libusb-1.0-1.0.23/libusb/os/sunos_usb.c:513:3: [2] (buffer) bcopy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. bcopy(rdata, dpriv->raw_cfgdescr, proplen); data/libusb-1.0-1.0.23/libusb/os/sunos_usb.c:748:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char filename[PATH_MAX + 1]; data/libusb-1.0-1.0.23/libusb/os/sunos_usb.c:757:25: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). hpriv->eps[0].datafd = open(filename, O_RDWR); data/libusb-1.0-1.0.23/libusb/os/sunos_usb.c:763:25: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). hpriv->eps[0].statfd = open(filename, O_RDONLY); data/libusb-1.0-1.0.23/libusb/os/sunos_usb.c:856:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char filename[PATH_MAX + 1], statfilename[PATH_MAX + 1]; data/libusb-1.0-1.0.23/libusb/os/sunos_usb.c:857:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char cfg_num[16], alt_num[16]; data/libusb-1.0-1.0.23/libusb/os/sunos_usb.c:913:17: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((fdstat = open(statfilename, O_RDWR)) == -1) { data/libusb-1.0-1.0.23/libusb/os/sunos_usb.c:946:12: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((fd = open(filename, mode)) == -1) { data/libusb-1.0-1.0.23/libusb/os/sunos_usb.c:953:16: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((fdstat = open(statfilename, O_RDONLY)) == -1) { data/libusb-1.0-1.0.23/libusb/os/sunos_usb.c:1029:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buf, &dpriv->dev_descr, LIBUSB_DT_DEVICE_SIZE); data/libusb-1.0-1.0.23/libusb/os/sunos_usb.c:1064:3: [2] (buffer) bcopy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. bcopy(rdata, dpriv->raw_cfgdescr, proplen); data/libusb-1.0-1.0.23/libusb/os/sunos_usb.c:1072:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buf, dpriv->raw_cfgdescr, len); data/libusb-1.0-1.0.23/libusb/os/wince_usb.c:46:9: [2] (buffer) TCHAR: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static TCHAR wErr_string[ERR_BUFFER_SIZE]; data/libusb-1.0-1.0.23/libusb/os/wince_usb.c:47:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char err_string[ERR_BUFFER_SIZE]; data/libusb-1.0-1.0.23/libusb/os/wince_usb.c:55:8: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. len = sprintf(err_string, "[%u] ", (unsigned int)error_code); data/libusb-1.0-1.0.23/libusb/os/wince_usb.c:75:4: [2] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). Risk is low because the source is a constant string. strcpy(err_string, "Unable to convert error string"); data/libusb-1.0-1.0.23/libusb/os/wince_usb.c:169:2: [2] (buffer) TCHAR: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. TCHAR sem_name[11 + 8 + 1]; // strlen("libusb_init") + (32-bit hex PID) + '\0' data/libusb-1.0-1.0.23/libusb/os/wince_usb.c:171:2: [2] (buffer) _stprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. _stprintf(sem_name, _T("libusb_init%08X"), (unsigned int)(GetCurrentProcessId() & 0xFFFFFFFF)); data/libusb-1.0-1.0.23/libusb/os/wince_usb.c:241:2: [2] (buffer) TCHAR: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. TCHAR sem_name[11 + 8 + 1]; // strlen("libusb_init") + (32-bit hex PID) + '\0' data/libusb-1.0-1.0.23/libusb/os/wince_usb.c:244:2: [2] (buffer) _stprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. _stprintf(sem_name, _T("libusb_init%08X"), (unsigned int)(GetCurrentProcessId() & 0xFFFFFFFF)); data/libusb-1.0-1.0.23/libusb/os/wince_usb.c:366:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buffer, &priv->desc, DEVICE_DESC_LENGTH); data/libusb-1.0-1.0.23/libusb/os/windows_nt_common.c:81:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char err_string[ERR_BUFFER_SIZE]; data/libusb-1.0-1.0.23/libusb/os/windows_nt_common.c:89:8: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. len = sprintf(err_string, "[%u] ", (unsigned int)error_code); data/libusb-1.0-1.0.23/libusb/os/windows_nt_common.c:605:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char sem_name[11 + 8 + 1]; // strlen("libusb_init") + (32-bit hex PID) + '\0' data/libusb-1.0-1.0.23/libusb/os/windows_nt_common.c:609:2: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(sem_name, "libusb_init%08X", (unsigned int)(GetCurrentProcessId() & 0xFFFFFFFF)); data/libusb-1.0-1.0.23/libusb/os/windows_nt_common.c:686:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char sem_name[11 + 8 + 1]; // strlen("libusb_init") + (32-bit hex PID) + '\0' data/libusb-1.0-1.0.23/libusb/os/windows_nt_common.c:689:2: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(sem_name, "libusb_init%08X", (unsigned int)(GetCurrentProcessId() & 0xFFFFFFFF)); data/libusb-1.0-1.0.23/libusb/os/windows_nt_common.c:748:24: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). return priv->backend->open(dev_handle); data/libusb-1.0-1.0.23/libusb/os/windows_nt_common.h:55:8: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). int (*open)(struct libusb_device_handle *dev_handle); data/libusb-1.0-1.0.23/libusb/os/windows_usbdk.c:207:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char dev_identity[ARRAYSIZE(id->DeviceID) + ARRAYSIZE(id->InstanceID) + 1]; data/libusb-1.0-1.0.23/libusb/os/windows_usbdk.c:277:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(&dev->device_descriptor, &info->DeviceDescriptor, LIBUSB_DT_DEVICE_SIZE); data/libusb-1.0-1.0.23/libusb/os/windows_usbdk.c:352:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buffer, &priv->info.DeviceDescriptor, DEVICE_DESC_LENGTH); data/libusb-1.0-1.0.23/libusb/os/windows_usbdk.c:369:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buffer, config_header, size); data/libusb-1.0-1.0.23/libusb/os/windows_winusb.c:128:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char guid_string[MAX_GUID_STRING_LENGTH]; data/libusb-1.0-1.0.23/libusb/os/windows_winusb.c:133:2: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(guid_string, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}", data/libusb-1.0-1.0.23/libusb/os/windows_winusb.c:172:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(ret_path, root_prefix, sizeof(root_prefix)); data/libusb-1.0-1.0.23/libusb/os/windows_winusb.c:425:6: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(filter_path, "\\\\.\\libusb0-%04u", (unsigned int)libusb0_symboliclink_index); data/libusb-1.0-1.0.23/libusb/os/windows_winusb.c:546:8: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. const char sep_str[2] = {LIST_SEPARATOR, 0}; data/libusb-1.0-1.0.23/libusb/os/windows_winusb.c:778:4: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(priv->config_descriptor[i], cd_data, cd_data->wTotalLength); data/libusb-1.0-1.0.23/libusb/os/windows_winusb.c:874:4: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(&priv->dev_descriptor, &(conn_info.DeviceDescriptor), sizeof(USB_DEVICE_DESCRIPTOR)); data/libusb-1.0-1.0.23/libusb/os/windows_winusb.c:1133:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char enumerator[16]; data/libusb-1.0-1.0.23/libusb/os/windows_winusb.c:1134:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char dev_id[MAX_PATH_LENGTH]; data/libusb-1.0-1.0.23/libusb/os/windows_winusb.c:1156:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char *usb_enumerator[8] = { "USB" }; data/libusb-1.0-1.0.23/libusb/os/windows_winusb.c:1551:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buffer, &priv->dev_descriptor, DEVICE_DESC_LENGTH); data/libusb-1.0-1.0.23/libusb/os/windows_winusb.c:1571:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buffer, priv->config_descriptor[config_index], size); data/libusb-1.0-1.0.23/libusb/os/windows_winusb.c:1615:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buffer, config_desc, len); data/libusb-1.0-1.0.23/libusb/os/windows_winusb.c:1623:34: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). CHECK_SUPPORTED_API(priv->apib, open); data/libusb-1.0-1.0.23/libusb/os/windows_winusb.c:1625:21: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). return priv->apib->open(SUB_API_NOTSET, dev_handle); data/libusb-1.0-1.0.23/libusb/os/windows_winusb.c:3099:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(data, &d, *size); data/libusb-1.0-1.0.23/libusb/os/windows_winusb.c:3108:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char tmp[HID_MAX_CONFIG_DESC_SIZE]; data/libusb-1.0-1.0.23/libusb/os/windows_winusb.c:3174:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(data, tmp, *size); data/libusb-1.0-1.0.23/libusb/os/windows_winusb.c:3222:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy((uint8_t *)data + 2, tmp, *size - 2); data/libusb-1.0-1.0.23/libusb/os/windows_winusb.c:3245:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(data, &d, *size); data/libusb-1.0-1.0.23/libusb/os/windows_winusb.c:3312:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(data, d, *size); data/libusb-1.0-1.0.23/libusb/os/windows_winusb.c:3422:4: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(data, buf + 1, *size); // Discard report ID data/libusb-1.0-1.0.23/libusb/os/windows_winusb.c:3424:4: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(data, buf, *size); data/libusb-1.0-1.0.23/libusb/os/windows_winusb.c:3471:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buf + 1, data, *size); data/libusb-1.0-1.0.23/libusb/os/windows_winusb.c:3475:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buf, data, *size); data/libusb-1.0-1.0.23/libusb/os/windows_winusb.c:3571:8: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. const char * const type[3] = {"input", "output", "feature"}; data/libusb-1.0-1.0.23/libusb/os/windows_winusb.c:3931:4: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(transfer_priv->hid_buffer + 1, transfer->buffer, transfer->length); data/libusb-1.0-1.0.23/libusb/os/windows_winusb.c:3934:4: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(transfer_priv->hid_buffer, transfer->buffer, transfer->length); data/libusb-1.0-1.0.23/libusb/os/windows_winusb.c:4072:6: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(transfer_priv->hid_dest, transfer_priv->hid_buffer + 1, corrected_size); data/libusb-1.0-1.0.23/libusb/os/windows_winusb.c:4074:6: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(transfer_priv->hid_dest, transfer_priv->hid_buffer, corrected_size); data/libusb-1.0-1.0.23/libusb/os/windows_winusb.c:4115:41: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). r = usb_api_backend[USB_API_WINUSBX].open(i, dev_handle); data/libusb-1.0-1.0.23/libusb/os/windows_winusb.h:102:8: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). int (*open)(int sub_api, struct libusb_device_handle *dev_handle); data/libusb-1.0-1.0.23/libusb/os/windows_winusb.h:252:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char list[MAX_KEY_LENGTH + 1]; // REG_MULTI_SZ list of services (driver) names data/libusb-1.0-1.0.23/libusb/sync.c:127:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buffer + LIBUSB_CONTROL_SETUP_SIZE, data, wLength); data/libusb-1.0-1.0.23/libusb/sync.c:141:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(data, libusb_control_transfer_get_data(transfer), data/libusb-1.0-1.0.23/msvc/missing.c:34:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char value[MAX_PATH]; data/libusb-1.0-1.0.23/msvc/missing.c:35:2: [2] (buffer) TCHAR: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. TCHAR wValue[MAX_PATH]; data/libusb-1.0-1.0.23/msvc/missing.c:44:6: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). if (MultiByteToWideChar(CP_UTF8, 0, name, -1, wName, MAX_PATH) <= 0) { data/libusb-1.0-1.0.23/tests/testlib.c:40:9: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). #define open _open data/libusb-1.0-1.0.23/tests/testlib.c:128:18: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). ctx->null_fd = open(NULL_PATH, O_WRONLY); data/libusb-1.0-1.0.23/examples/ezusb.c:329:24: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if ((len * 2) + 11 > strlen(buf)) { data/libusb-1.0-1.0.23/examples/fxload.c:266:20: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). ext = path[i] + strlen(path[i]) - 4; data/libusb-1.0-1.0.23/examples/getopt/getopt.c:239:51: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). # if (!defined __STDC__ || !__STDC__) && !defined strlen data/libusb-1.0-1.0.23/examples/getopt/getopt.c:242:12: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). extern int strlen (const char *); data/libusb-1.0-1.0.23/examples/getopt/getopt.c:433:44: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). int len = nonoption_flags_max_len = strlen (orig_str); data/libusb-1.0-1.0.23/examples/getopt/getopt.c:661:21: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). == (unsigned int) strlen (p->name)) data/libusb-1.0-1.0.23/examples/getopt/getopt.c:688:16: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). nextchar += strlen (nextchar); data/libusb-1.0-1.0.23/examples/getopt/getopt.c:720:17: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). nextchar += strlen (nextchar); data/libusb-1.0-1.0.23/examples/getopt/getopt.c:736:17: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). nextchar += strlen (nextchar); data/libusb-1.0-1.0.23/examples/getopt/getopt.c:741:16: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). nextchar += strlen (nextchar); data/libusb-1.0-1.0.23/examples/getopt/getopt.c:852:51: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if ((unsigned int) (nameend - nextchar) == strlen (p->name)) data/libusb-1.0-1.0.23/examples/getopt/getopt.c:875:18: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). nextchar += strlen (nextchar); data/libusb-1.0-1.0.23/examples/getopt/getopt.c:895:19: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). nextchar += strlen (nextchar); data/libusb-1.0-1.0.23/examples/getopt/getopt.c:909:19: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). nextchar += strlen (nextchar); data/libusb-1.0-1.0.23/examples/getopt/getopt.c:913:18: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). nextchar += strlen (nextchar); data/libusb-1.0-1.0.23/examples/testlibusb.c:200:28: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). snprintf(description + strlen(description), sizeof(description) - data/libusb-1.0-1.0.23/examples/testlibusb.c:201:5: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). strlen(description), "%s", string); data/libusb-1.0-1.0.23/examples/testlibusb.c:203:28: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). snprintf(description + strlen(description), sizeof(description) - data/libusb-1.0-1.0.23/examples/testlibusb.c:204:5: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). strlen(description), "%04X", desc.idProduct); data/libusb-1.0-1.0.23/examples/testlibusb.c:207:27: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). snprintf(description + strlen(description), sizeof(description) - data/libusb-1.0-1.0.23/examples/testlibusb.c:208:4: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). strlen(description), "%04X", desc.idProduct); data/libusb-1.0-1.0.23/examples/xusb.c:1001:13: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). arglen = strlen(argv[j]); data/libusb-1.0-1.0.23/libusb/os/linux_netlink.c:190:18: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t keylen = strlen(key); data/libusb-1.0-1.0.23/libusb/os/linux_netlink.c:195:13: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). buffer += strlen(buffer) + 1; data/libusb-1.0-1.0.23/libusb/os/linux_netlink.c:383:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). nb = read(netlink_control_pipe[0], &dummy, sizeof(dummy)); data/libusb-1.0-1.0.23/libusb/os/linux_udev.c:199:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). nb = read(udev_control_pipe[0], &dummy, sizeof(dummy)); data/libusb-1.0-1.0.23/libusb/os/linux_usbfs.c:665:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). r = read(fd, tmp, sizeof(tmp)); data/libusb-1.0-1.0.23/libusb/os/linux_usbfs.c:1030:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). r = read(fd, priv->descriptors + priv->descriptors_len, data/libusb-1.0-1.0.23/libusb/os/netbsd_usb.c:671:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). nr = read(fd, transfer->buffer, transfer->length); data/libusb-1.0-1.0.23/libusb/os/openbsd_usb.c:728:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). nr = read(fd, transfer->buffer, transfer->length); data/libusb-1.0-1.0.23/libusb/os/poll_posix.h:5:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). #define usbi_read read data/libusb-1.0-1.0.23/libusb/os/sunos_usb.c:100:12: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). start += strlen("/devices"); data/libusb-1.0-1.0.23/libusb/os/sunos_usb.c:114:31: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). *(larg->linkpp) = strndup(p, strlen(p) - strlen(q)); data/libusb-1.0-1.0.23/libusb/os/sunos_usb.c:114:43: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). *(larg->linkpp) = strndup(p, strlen(p) - strlen(q)); data/libusb-1.0-1.0.23/libusb/os/sunos_usb.c:133:13: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). larg.len = strlen(node_path); data/libusb-1.0-1.0.23/libusb/os/sunos_usb.c:1277:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, data, size); data/libusb-1.0-1.0.23/libusb/os/sunos_usb.c:1561:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, &status, sizeof (status)); data/libusb-1.0-1.0.23/libusb/os/windows_winusb.c:156:9: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size = strlen(path) + 1; data/libusb-1.0-1.0.23/libusb/os/windows_winusb.c:548:15: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t len = strlen(driver); data/libusb-1.0-1.0.23/libusb/os/windows_winusb.c:1014:20: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). lookup[k].list[strlen(lookup[k].list) + 1] = 0; data/libusb-1.0-1.0.23/libusb/os/windows_winusb.c:2313:69: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (strncmp(dev_path_no_guid, priv->usb_interface[iface].path, strlen(dev_path_no_guid)) == 0) { data/libusb-1.0-1.0.23/libusb/strerror.c:193:28: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if ( (locale == NULL) || (strlen(locale) < 2) data/libusb-1.0-1.0.23/libusb/strerror.c:194:9: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). || ((strlen(locale) > 2) && (locale[2] != '-') && (locale[2] != '_') && (locale[2] != '.')) ) data/libusb-1.0-1.0.23/tests/testlib.c:191:13: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). arglen = strlen(argv[j]); ANALYSIS SUMMARY: Hits = 267 Lines analyzed = 38909 in approximately 1.00 seconds (38759 lines/second) Physical Source Lines of Code (SLOC) = 24985 Hits@level = [0] 400 [1] 44 [2] 179 [3] 23 [4] 19 [5] 2 Hits@level+ = [0+] 667 [1+] 267 [2+] 223 [3+] 44 [4+] 21 [5+] 2 Hits/KSLOC@level+ = [0+] 26.696 [1+] 10.6864 [2+] 8.92536 [3+] 1.76106 [4+] 0.840504 [5+] 0.080048 Dot directories skipped = 1 (--followdotdir overrides) Minimum risk level = 1 Not every hit is necessarily a security vulnerability. There may be other security vulnerabilities; review your code! See 'Secure Programming HOWTO' (https://dwheeler.com/secure-programs) for more information.