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/wimlib-1.13.3/programs/imagex.c Examining data/wimlib-1.13.3/programs/imagex-win32.h Examining data/wimlib-1.13.3/programs/wgetopt.h Examining data/wimlib-1.13.3/programs/wgetopt.c Examining data/wimlib-1.13.3/programs/imagex-win32.c Examining data/wimlib-1.13.3/include/wimlib/pattern.h Examining data/wimlib-1.13.3/include/wimlib/lz_hash.h Examining data/wimlib-1.13.3/include/wimlib/test_support.h Examining data/wimlib-1.13.3/include/wimlib/scan.h Examining data/wimlib-1.13.3/include/wimlib/endianness.h Examining data/wimlib-1.13.3/include/wimlib/progress.h Examining data/wimlib-1.13.3/include/wimlib/registry.h Examining data/wimlib-1.13.3/include/wimlib/decompressor_ops.h Examining data/wimlib-1.13.3/include/wimlib/wof.h Examining data/wimlib-1.13.3/include/wimlib/guid.h Examining data/wimlib-1.13.3/include/wimlib/error.h Examining data/wimlib-1.13.3/include/wimlib/hc_matchfinder.h Examining data/wimlib-1.13.3/include/wimlib/alloca.h Examining data/wimlib-1.13.3/include/wimlib/solid.h Examining data/wimlib-1.13.3/include/wimlib/divsufsort.h Examining data/wimlib-1.13.3/include/wimlib/list.h Examining data/wimlib-1.13.3/include/wimlib/xml.h Examining data/wimlib-1.13.3/include/wimlib/decompress_common.h Examining data/wimlib-1.13.3/include/wimlib/compiler.h Examining data/wimlib-1.13.3/include/wimlib/resource.h Examining data/wimlib-1.13.3/include/wimlib/dentry.h Examining data/wimlib-1.13.3/include/wimlib/xpress_constants.h Examining data/wimlib-1.13.3/include/wimlib/lzx_constants.h Examining data/wimlib-1.13.3/include/wimlib/win32_common.h Examining data/wimlib-1.13.3/include/wimlib/unix_data.h Examining data/wimlib-1.13.3/include/wimlib/wimboot.h Examining data/wimlib-1.13.3/include/wimlib/object_id.h Examining data/wimlib-1.13.3/include/wimlib/header.h Examining data/wimlib-1.13.3/include/wimlib/win32_vss.h Examining data/wimlib-1.13.3/include/wimlib/reparse.h Examining data/wimlib-1.13.3/include/wimlib/ntfs_3g.h Examining data/wimlib-1.13.3/include/wimlib/avl_tree.h Examining data/wimlib-1.13.3/include/wimlib/inode_table.h Examining data/wimlib-1.13.3/include/wimlib/write.h Examining data/wimlib-1.13.3/include/wimlib/util.h Examining data/wimlib-1.13.3/include/wimlib/case.h Examining data/wimlib-1.13.3/include/wimlib/metadata.h Examining data/wimlib-1.13.3/include/wimlib/security.h Examining data/wimlib-1.13.3/include/wimlib/security_descriptor.h Examining data/wimlib-1.13.3/include/wimlib/inode.h Examining data/wimlib-1.13.3/include/wimlib/wim.h Examining data/wimlib-1.13.3/include/wimlib/tagged_items.h Examining data/wimlib-1.13.3/include/wimlib/pathlist.h Examining data/wimlib-1.13.3/include/wimlib/compress_common.h Examining data/wimlib-1.13.3/include/wimlib/blob_table.h Examining data/wimlib-1.13.3/include/wimlib/bt_matchfinder.h Examining data/wimlib-1.13.3/include/wimlib/glob.h Examining data/wimlib-1.13.3/include/wimlib/chunk_compressor.h Examining data/wimlib-1.13.3/include/wimlib/x86_cpu_features.h Examining data/wimlib-1.13.3/include/wimlib/apply.h Examining data/wimlib-1.13.3/include/wimlib/file_io.h Examining data/wimlib-1.13.3/include/wimlib/integrity.h Examining data/wimlib-1.13.3/include/wimlib/compressor_ops.h Examining data/wimlib-1.13.3/include/wimlib/win32.h Examining data/wimlib-1.13.3/include/wimlib/xml_windows.h Examining data/wimlib-1.13.3/include/wimlib/lzms_common.h Examining data/wimlib-1.13.3/include/wimlib/lcpit_matchfinder.h Examining data/wimlib-1.13.3/include/wimlib/lz_extend.h Examining data/wimlib-1.13.3/include/wimlib/types.h Examining data/wimlib-1.13.3/include/wimlib/encoding.h Examining data/wimlib-1.13.3/include/wimlib/bitops.h Examining data/wimlib-1.13.3/include/wimlib/assert.h Examining data/wimlib-1.13.3/include/wimlib/unaligned.h Examining data/wimlib-1.13.3/include/wimlib/lzms_constants.h Examining data/wimlib-1.13.3/include/wimlib/timestamp.h Examining data/wimlib-1.13.3/include/wimlib/paths.h Examining data/wimlib-1.13.3/include/wimlib/xattr.h Examining data/wimlib-1.13.3/include/wimlib/textfile.h Examining data/wimlib-1.13.3/include/wimlib/lzx_common.h Examining data/wimlib-1.13.3/include/wimlib/sha1.h Examining data/wimlib-1.13.3/include/wimlib.h Examining data/wimlib-1.13.3/include/wimlib_tchar.h Examining data/wimlib-1.13.3/src/export_image.c Examining data/wimlib-1.13.3/src/win32_apply.c Examining data/wimlib-1.13.3/src/lzms_compress.c Examining data/wimlib-1.13.3/src/blob_table.c Examining data/wimlib-1.13.3/src/compress_parallel.c Examining data/wimlib-1.13.3/src/resource.c Examining data/wimlib-1.13.3/src/metadata_resource.c Examining data/wimlib-1.13.3/src/xpress_compress.c Examining data/wimlib-1.13.3/src/ntfs-3g_apply.c Examining data/wimlib-1.13.3/src/decompress.c Examining data/wimlib-1.13.3/src/lzx_compress.c Examining data/wimlib-1.13.3/src/xml_windows.c Examining data/wimlib-1.13.3/src/avl_tree.c Examining data/wimlib-1.13.3/src/sha1.c Examining data/wimlib-1.13.3/src/lcpit_matchfinder.c Examining data/wimlib-1.13.3/src/template.c Examining data/wimlib-1.13.3/src/timestamp.c Examining data/wimlib-1.13.3/src/lzx_common.c Examining data/wimlib-1.13.3/src/compress_common.c Examining data/wimlib-1.13.3/src/lzms_decompress.c Examining data/wimlib-1.13.3/src/decompress_common.c Examining data/wimlib-1.13.3/src/unix_apply.c Examining data/wimlib-1.13.3/src/textfile.c Examining data/wimlib-1.13.3/src/mount_image.c Examining data/wimlib-1.13.3/src/reparse.c Examining data/wimlib-1.13.3/src/unix_capture.c Examining data/wimlib-1.13.3/src/win32_common.c Examining data/wimlib-1.13.3/src/delete_image.c Examining data/wimlib-1.13.3/src/xml.c Examining data/wimlib-1.13.3/src/xpress_decompress.c Examining data/wimlib-1.13.3/src/update_image.c Examining data/wimlib-1.13.3/src/verify.c Examining data/wimlib-1.13.3/src/x86_cpu_features.c Examining data/wimlib-1.13.3/src/integrity.c Examining data/wimlib-1.13.3/src/scan.c Examining data/wimlib-1.13.3/src/encoding.c Examining data/wimlib-1.13.3/src/error.c Examining data/wimlib-1.13.3/src/lzms_common.c Examining data/wimlib-1.13.3/src/tagged_items.c Examining data/wimlib-1.13.3/src/file_io.c Examining data/wimlib-1.13.3/src/paths.c Examining data/wimlib-1.13.3/src/progress.c Examining data/wimlib-1.13.3/src/header.c Examining data/wimlib-1.13.3/src/pattern.c Examining data/wimlib-1.13.3/src/wimboot.c Examining data/wimlib-1.13.3/src/compress_serial.c Examining data/wimlib-1.13.3/src/extract.c Examining data/wimlib-1.13.3/src/dentry.c Examining data/wimlib-1.13.3/src/divsufsort.c Examining data/wimlib-1.13.3/src/test_support.c Examining data/wimlib-1.13.3/src/win32_capture.c Examining data/wimlib-1.13.3/src/win32_vss.c Examining data/wimlib-1.13.3/src/util.c Examining data/wimlib-1.13.3/src/write.c Examining data/wimlib-1.13.3/src/pathlist.c Examining data/wimlib-1.13.3/src/iterate_dir.c Examining data/wimlib-1.13.3/src/add_image.c Examining data/wimlib-1.13.3/src/lzx_decompress.c Examining data/wimlib-1.13.3/src/wim.c Examining data/wimlib-1.13.3/src/inode.c Examining data/wimlib-1.13.3/src/inode_table.c Examining data/wimlib-1.13.3/src/registry.c Examining data/wimlib-1.13.3/src/split.c Examining data/wimlib-1.13.3/src/join.c Examining data/wimlib-1.13.3/src/solid.c Examining data/wimlib-1.13.3/src/ntfs-3g_capture.c Examining data/wimlib-1.13.3/src/reference.c Examining data/wimlib-1.13.3/src/security.c Examining data/wimlib-1.13.3/src/compress.c Examining data/wimlib-1.13.3/src/inode_fixup.c Examining data/wimlib-1.13.3/src/win32_replacements.c Examining data/wimlib-1.13.3/examples/capturewim.c Examining data/wimlib-1.13.3/examples/compressfile.c Examining data/wimlib-1.13.3/examples/decompressfile.c Examining data/wimlib-1.13.3/examples/applywim.c Examining data/wimlib-1.13.3/examples/updatewim.c Examining data/wimlib-1.13.3/tests/tree-cmp.c Examining data/wimlib-1.13.3/tests/wlfuzz.c FINAL RESULTS: data/wimlib-1.13.3/src/unix_apply.c:266:17: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. if (fd < 0 && !chmod(path, mode)) data/wimlib-1.13.3/src/unix_capture.c:85:3: [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. readlink((full_path), (buf), (bufsize)) data/wimlib-1.13.3/tests/tree-cmp.c:392:10: [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. ret1 = readlink(file1, buf1, sizeof(buf1)); data/wimlib-1.13.3/tests/tree-cmp.c:395:10: [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. ret2 = readlink(file2, buf2, sizeof(buf2)); data/wimlib-1.13.3/examples/compressfile.c:103: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, va); data/wimlib-1.13.3/examples/decompressfile.c:94: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, va); data/wimlib-1.13.3/include/wimlib/error.h:10:37: [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. static inline int _format_attribute(printf, 1, 2) data/wimlib-1.13.3/include/wimlib/error.h:19:20: [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. _format_attribute(printf, 1, 2) _cold_attribute; data/wimlib-1.13.3/include/wimlib/error.h:23:21: [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. _format_attribute(printf, 1, 2) _cold_attribute; data/wimlib-1.13.3/include/wimlib/error.h:27:21: [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. _format_attribute(printf, 1, 2) _cold_attribute; data/wimlib-1.13.3/include/wimlib/error.h:31:21: [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. _format_attribute(printf, 1, 2) _cold_attribute; data/wimlib-1.13.3/include/wimlib_tchar.h:27:19: [4] (buffer) wcscat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). # define tstrcat wcscat data/wimlib-1.13.3/include/wimlib_tchar.h:28:19: [4] (buffer) wcscpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using a function version that stops copying at the end of the buffer. # define tstrcpy wcscpy data/wimlib-1.13.3/include/wimlib_tchar.h:29:19: [4] (format) wprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. # define tprintf wprintf data/wimlib-1.13.3/include/wimlib_tchar.h:30:20: [4] (buffer) swprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. # define tsprintf swprintf data/wimlib-1.13.3/include/wimlib_tchar.h:31:20: [4] (format) fwprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. # define tfprintf fwprintf data/wimlib-1.13.3/include/wimlib_tchar.h:32:21: [4] (format) vfwprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. # define tvfprintf vfwprintf data/wimlib-1.13.3/include/wimlib_tchar.h:89:19: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). # define tstrcat strcat data/wimlib-1.13.3/include/wimlib_tchar.h:90:19: [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). # define tstrcpy strcpy data/wimlib-1.13.3/include/wimlib_tchar.h:91:19: [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. # define tprintf printf data/wimlib-1.13.3/include/wimlib_tchar.h:92:20: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. # define tsprintf sprintf data/wimlib-1.13.3/include/wimlib_tchar.h:93:20: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. # define tfprintf fprintf data/wimlib-1.13.3/include/wimlib_tchar.h:94:21: [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. # define tvfprintf vfprintf data/wimlib-1.13.3/include/wimlib_tchar.h:95:18: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. # define tscanf sscanf data/wimlib-1.13.3/include/wimlib_tchar.h:127:19: [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. # define taccess access data/wimlib-1.13.3/programs/imagex.c:460:31: [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. static void _format_attribute(printf, 1, 2) data/wimlib-1.13.3/programs/imagex.c:472:31: [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. static void _format_attribute(printf, 1, 2) data/wimlib-1.13.3/src/extract.c:407:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(name, "%s/wimlibXXXXXX", tmpdir); data/wimlib-1.13.3/src/win32_capture.c:308:3: [4] (format) swprintf: Potential format string problem (CWE-134). Make format string constant. swprintf((wchar_t *)buf, L"NTFS inode 0x%016"PRIx64, file_id); data/wimlib-1.13.3/src/xml.c:313:2: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(buf, "0x%08"PRIX32, (u32)(timestamp >> 32)); data/wimlib-1.13.3/src/xml.c:317:2: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(buf, "0x%08"PRIX32, (u32)timestamp); data/wimlib-1.13.3/src/xml.c:336:2: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(buf, "%"PRIu64, value); data/wimlib-1.13.3/src/xml_windows.c:694:34: [4] (shell) system: 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. const struct wim_dentry *system) data/wimlib-1.13.3/src/xml_windows.c:717:33: [4] (shell) system: 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. if ((contents = load_hive(ctx, system, "SYSTEM"))) { data/wimlib-1.13.3/src/xml_windows.c:833:39: [4] (shell) system: 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. score = !!kernel32 + !!software + !!system; data/wimlib-1.13.3/src/xml_windows.c:843:19: [4] (shell) system: 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. best_system = system; data/wimlib-1.13.3/tests/tree-cmp.c:46:3: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stdout, "[%s %d] %s(): " format, \ data/wimlib-1.13.3/tests/tree-cmp.c:63: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, va); data/wimlib-1.13.3/tests/tree-cmp.c:77: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, va); data/wimlib-1.13.3/tests/tree-cmp.c:415: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(dir1, argv[1]); data/wimlib-1.13.3/tests/tree-cmp.c:416: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(dir2, argv[2]); data/wimlib-1.13.3/tests/wlfuzz.c:100: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, va); data/wimlib-1.13.3/tests/wlfuzz.c:178:3: [4] (shell) execlp: 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. execlp("mkntfs", "mkntfs", "--force", "--fast", data/wimlib-1.13.3/include/wimlib/win32.h:40:1: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. realpath(const tchar *path, tchar *resolved_path); data/wimlib-1.13.3/include/wimlib_tchar.h:123:19: [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. # define tgetenv getenv data/wimlib-1.13.3/programs/imagex-win32.h:27:9: [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. #define getopt_long wgetopt_long data/wimlib-1.13.3/programs/imagex-win32.h:28:9: [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. #define getopt wgetopt data/wimlib-1.13.3/programs/imagex.c:63:28: [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. # define getopt_long_only getopt_long data/wimlib-1.13.3/programs/wgetopt.c:200: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/wimlib-1.13.3/src/extract.c:401:23: [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 *tmpdir = getenv("TMPDIR"); data/wimlib-1.13.3/src/mount_image.c:2178:27: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. ctx.mountpoint_abspath = realpath(dir, NULL); data/wimlib-1.13.3/src/unix_apply.c:924:25: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. ctx->target_abspath = realpath(ctx->common.target, NULL); data/wimlib-1.13.3/src/wim.c:663:19: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. wim->filename = realpath(wimfile, NULL); data/wimlib-1.13.3/src/win32_common.c:109:17: [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. ntdll_handle = LoadLibrary(L"ntdll.dll"); data/wimlib-1.13.3/src/win32_common.c:208:17: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. file_abspath = realpath(file_path, NULL); data/wimlib-1.13.3/src/win32_common.c:233:11: [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. fltlib = LoadLibrary(L"Fltlib.dll"); data/wimlib-1.13.3/src/win32_replacements.c:365:1: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. realpath(const wchar_t *path, wchar_t *resolved_path) data/wimlib-1.13.3/src/win32_vss.c:324:12: [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. hVssapi = LoadLibrary(L"vssapi.dll"); data/wimlib-1.13.3/src/win32_vss.c:355:11: [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. hOle32 = LoadLibrary(L"ole32.dll"); data/wimlib-1.13.3/src/win32_vss.c:537:19: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. source_abspath = realpath(source, NULL); data/wimlib-1.13.3/tests/wlfuzz.c:126:23: [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 *tmpdir = getenv("TMPDIR"); data/wimlib-1.13.3/examples/compressfile.c:91: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). # define topen open data/wimlib-1.13.3/examples/decompressfile.c:84: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). # define topen open data/wimlib-1.13.3/include/wimlib/decompress_common.h:186: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(dst_buffer, is->next, count); data/wimlib-1.13.3/include/wimlib/encoding.h:28: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(out, in, in_nbytes); data/wimlib-1.13.3/include/wimlib/guid.h:19: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(dest, src, GUID_SIZE); data/wimlib-1.13.3/include/wimlib/progress.h:79:5: [2] (buffer) wchar_t: 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. ((wchar_t *)path)[1] = L'\\'; data/wimlib-1.13.3/include/wimlib/resource.h:113: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(dest, src, sizeof(struct wim_reshdr)); data/wimlib-1.13.3/include/wimlib/sha1.h:39: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(dest, src, SHA1_HASH_SIZE); data/wimlib-1.13.3/include/wimlib/unaligned.h:42: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(p, &v, sizeof(v)); \ data/wimlib-1.13.3/include/wimlib/wimboot.h:12:36: [2] (buffer) wchar_t: 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. wimboot_alloc_data_source_id(const wchar_t *wim_path, data/wimlib-1.13.3/include/wimlib/win32_common.h:140:28: [2] (buffer) wchar_t: 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. win32_get_drive_path(const wchar_t *file_path, wchar_t drive_path[7]); data/wimlib-1.13.3/include/wimlib/win32_common.h:140:48: [2] (buffer) wchar_t: 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. win32_get_drive_path(const wchar_t *file_path, wchar_t drive_path[7]); data/wimlib-1.13.3/include/wimlib/xattr.h:37: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 name[0]; data/wimlib-1.13.3/include/wimlib/xattr.h:95: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 name[0]; data/wimlib-1.13.3/include/wimlib_tchar.h:86:19: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. # define tmemcpy memcpy data/wimlib-1.13.3/include/wimlib_tchar.h:112:18: [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). # define tfopen fopen data/wimlib-1.13.3/include/wimlib_tchar.h:113: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). # define topen open data/wimlib-1.13.3/programs/imagex-win32.c:26:12: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). int len = MultiByteToWideChar(CP_ACP, data/wimlib-1.13.3/programs/imagex-win32.c:39:13: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). int len2 = MultiByteToWideChar(CP_ACP, data/wimlib-1.13.3/src/dentry.c:507: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(p, d->d_name, d->d_name_nbytes); data/wimlib-1.13.3/src/dentry.c:1131: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(inode->i_extra->data, p, end - p); data/wimlib-1.13.3/src/encoding.c:434: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(dup, s, size); data/wimlib-1.13.3/src/error.c:167: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). fp = fopen(path, "a"); data/wimlib-1.13.3/src/extract.c:229: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(pwm_hdr_ret, &blob_hdr, sizeof(blob_hdr)); data/wimlib-1.13.3/src/extract.c:408:11: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). raw_fd = mkstemp(name); data/wimlib-1.13.3/src/extract.c:500: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(&tmpfile_blob, orig_blob, sizeof(struct blob_descriptor)); data/wimlib-1.13.3/src/extract.c:877: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(utf16_name_copy, dentry->d_name, dentry->d_name_nbytes); data/wimlib-1.13.3/src/extract.c:1060: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(targets, data/wimlib-1.13.3/src/inode.c:286: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(streams, inode->i_streams, data/wimlib-1.13.3/src/lzms_compress.c:2188: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(c->in_buffer, in, in_nbytes); data/wimlib-1.13.3/src/lzx_common.c:192: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(saved_bytes, tail, 6); data/wimlib-1.13.3/src/lzx_common.c:203: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(tail, saved_bytes, 6); data/wimlib-1.13.3/src/lzx_compress.c:2922: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(c->in_buffer, in, in_nbytes); data/wimlib-1.13.3/src/lzx_decompress.c:382: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(d->extra_offset_bits, d->extra_offset_bits_minus_aligned, data/wimlib-1.13.3/src/lzx_decompress.c:386: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(d->extra_offset_bits, lzx_extra_offset_bits, data/wimlib-1.13.3/src/lzx_decompress.c:540: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(d->extra_offset_bits_minus_aligned, lzx_extra_offset_bits, data/wimlib-1.13.3/src/mount_image.c:83: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 mq_name[WIMFS_MQUEUE_NAME_LEN + 1]; data/wimlib-1.13.3/src/mount_image.c:838:15: [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 const char common_suffix[8] = ".staging"; data/wimlib-1.13.3/src/mount_image.c:907:23: [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->parent_dir_fd = open(parent_dir_path, O_RDONLY | O_DIRECTORY); data/wimlib-1.13.3/src/mount_image.c:1303: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(dest, src, srcsize); data/wimlib-1.13.3/src/mount_image.c:1350: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(value, &status, sizeof(int)); data/wimlib-1.13.3/src/mount_image.c:1677: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, blob->attached_buffer + offset, size); data/wimlib-1.13.3/src/mount_image.c:1830: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(&ctx->unmount_info, value, data/wimlib-1.13.3/src/mount_image.c:1981:21: [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. wimfs_utimens(const char *path, const struct timespec tv[2]) data/wimlib-1.13.3/src/mount_image.c:2091: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 *fuse_argv[16]; data/wimlib-1.13.3/src/mount_image.c:2243: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 optstring[256] = data/wimlib-1.13.3/src/mount_image.c:2256:3: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat(optstring, ",ro"); data/wimlib-1.13.3/src/mount_image.c:2258:3: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat(optstring, ",allow_other"); data/wimlib-1.13.3/src/mount_image.c:2304:29: [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. generate_message_queue_name(char name[WIMFS_MQUEUE_NAME_LEN + 1]) data/wimlib-1.13.3/src/mount_image.c:2307: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(name + 1, "wimfs-", 6); data/wimlib-1.13.3/src/mount_image.c:2428: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 empty[1]; data/wimlib-1.13.3/src/mount_image.c:2466: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 wim_filename[wim_filename_len + 1]; data/wimlib-1.13.3/src/ntfs-3g_capture.c:487: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[4096]; data/wimlib-1.13.3/src/ntfs-3g_capture.c:533: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 dos_name[24]; data/wimlib-1.13.3/src/ntfs-3g_capture.c:566: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(new_node->dos_name, dos_name, name_nbytes); data/wimlib-1.13.3/src/registry.c:86: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 name[0]; data/wimlib-1.13.3/src/registry.c:135: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 name[0]; data/wimlib-1.13.3/src/reparse.c:200: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_p, src, n); data/wimlib-1.13.3/src/reparse.c:402: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(link.substitute_name, prefix, sizeof(prefix)); data/wimlib-1.13.3/src/reparse.c:403: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(link.substitute_name + ARRAY_LEN(prefix), target, target_nbytes); data/wimlib-1.13.3/src/sha1.c:180: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(&ctx->buffer[buffered], data, len); data/wimlib-1.13.3/src/sha1.c:184: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(&ctx->buffer[buffered], data, 64 - buffered); data/wimlib-1.13.3/src/sha1.c:201: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(ctx->buffer, data, len); data/wimlib-1.13.3/src/tagged_items.c:149: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(p, data, len); data/wimlib-1.13.3/src/test_support.c:474: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 entries[8192]; data/wimlib-1.13.3/src/test_support.c:572: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 desc[8192] _aligned_attribute(8); data/wimlib-1.13.3/src/test_support.c:717: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(&targets[target_nchars + 1], targets, 2*target_nchars); data/wimlib-1.13.3/src/unix_apply.c:80: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 *pathbufs[NUM_PATHBUFS]; data/wimlib-1.13.3/src/unix_apply.c:175: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(p, d->d_extraction_name, data/wimlib-1.13.3/src/unix_apply.c:279: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 name[WIM_XATTR_NAME_MAX + 1]; data/wimlib-1.13.3/src/unix_apply.c:311: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(name, e->name, name_len); data/wimlib-1.13.3/src/unix_apply.c:318: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(name, e->name, name_len); data/wimlib-1.13.3/src/unix_apply.c:570: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(path, O_EXCL | O_CREAT | O_WRONLY | O_NOFOLLOW, 0644); data/wimlib-1.13.3/src/unix_apply.c:643: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 target[REPARSE_POINT_MAX_SIZE]; data/wimlib-1.13.3/src/unix_apply.c:712: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(first_path, O_EXCL | O_CREAT | O_WRONLY | O_NOFOLLOW, 0644); data/wimlib-1.13.3/src/unix_apply.c:897: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(ctx->pathbufs[i], data/wimlib-1.13.3/src/unix_capture.c:56: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). old_pwd = open(".", O_RDONLY); data/wimlib-1.13.3/src/unix_capture.c:77:3: [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). open((full_path), (flags)) data/wimlib-1.13.3/src/unix_capture.c:180: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 _entries[1024]; data/wimlib-1.13.3/src/unix_capture.c:229: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 _names[256]; data/wimlib-1.13.3/src/unix_capture.c:468: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 orig_target[REPARSE_POINT_MAX_SIZE]; data/wimlib-1.13.3/src/update_image.c:216: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(new_entries, l->inline_entries, data/wimlib-1.13.3/src/util.c:143:9: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. ptr = memcpy(ptr, mem, size); data/wimlib-1.13.3/src/util.c:169:9: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. return memcpy(dst, src, n) + n; data/wimlib-1.13.3/src/util.c:215: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). int fd = open("/dev/urandom", O_RDONLY); data/wimlib-1.13.3/src/wimboot.c:325:16: [2] (buffer) wchar_t: 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 wchar_t *wim_path, data/wimlib-1.13.3/src/wimboot.c:418: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(new_entry_2->partition.gpt.part_unique_guid, data/wimlib-1.13.3/src/wimboot.c:425: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(new_entry_2->disk.gpt.disk_guid, data/wimlib-1.13.3/src/wimboot.c:469:16: [2] (buffer) wchar_t: 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 wchar_t *wim_path, data/wimlib-1.13.3/src/wimboot.c:785:34: [2] (buffer) wchar_t: 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. update_wimoverlay_manually(const wchar_t *drive, const wchar_t *wim_path, data/wimlib-1.13.3/src/wimboot.c:785:56: [2] (buffer) wchar_t: 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. update_wimoverlay_manually(const wchar_t *drive, const wchar_t *wim_path, data/wimlib-1.13.3/src/wimboot.c:880:36: [2] (buffer) wchar_t: 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. wimboot_alloc_data_source_id(const wchar_t *wim_path, data/wimlib-1.13.3/src/win32_apply.c:206:2: [2] (buffer) wchar_t: 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. wchar_t filesystem_name[MAX_PATH + 1]; data/wimlib-1.13.3/src/win32_apply.c:207:2: [2] (buffer) wchar_t: 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. wchar_t drive[4]; data/wimlib-1.13.3/src/win32_apply.c:795:2: [2] (buffer) wchar_t: 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. wchar_t subkeyname[32]; data/wimlib-1.13.3/src/win32_apply.c:822:2: [2] (buffer) wcscpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using a function version that stops copying at the end of the buffer. Risk is low because the source is a constant string. wcscpy(&subkeyname[20], L"\\Setup"); data/wimlib-1.13.3/src/win32_apply.c:993: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(ctx->pathbuf.Buffer, ctx->target_ntpath.Buffer, data/wimlib-1.13.3/src/win32_apply.c:1285:3: [2] (buffer) wcscpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using a function version that stops copying at the end of the buffer. Risk is low because the source is a constant string. wcscpy(&info->FileName[8], L".WLB"); data/wimlib-1.13.3/src/win32_apply.c:1337: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(info->FileName, dentry->d_short_name, dentry->d_short_name_nbytes); data/wimlib-1.13.3/src/win32_apply.c:1349:4: [2] (buffer) wchar_t: 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. wchar_t volume[7]; data/wimlib-1.13.3/src/win32_apply.c:1853: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(info->FileName, ctx->pathbuf.Buffer, ctx->pathbuf.Length); data/wimlib-1.13.3/src/win32_apply.c:2199:2: [2] (buffer) wchar_t: 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. wchar_t fixed_subst_name[fixed_subst_name_nchars]; data/wimlib-1.13.3/src/win32_apply.c:2232: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(&ctx->rpfixbuf, rpbuf, rpbuflen); data/wimlib-1.13.3/src/win32_apply.c:2248: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(pbData, &ctx->data_buffer[ctx->encrypted_offset], copy_len); data/wimlib-1.13.3/src/win32_apply.c:2619:3: [2] (buffer) wchar_t: 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. wchar_t drive_path[7]; data/wimlib-1.13.3/src/win32_apply.c:2746: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(ctx->rpbuf.rpdata, ctx->data_buffer, blob->size); data/wimlib-1.13.3/src/win32_apply.c:2974: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(desc, _desc, desc_size); data/wimlib-1.13.3/src/win32_capture.c:95:2: [2] (buffer) wchar_t: 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. wchar_t path[0]; data/wimlib-1.13.3/src/win32_capture.c:310:3: [2] (buffer) swprintf: 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. swprintf((wchar_t *)buf, L"\"%ls\"", file->path); data/wimlib-1.13.3/src/win32_capture.c:1015:2: [2] (buffer) wchar_t: 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. wchar_t print_name0[print_name_nchars + 1]; data/wimlib-1.13.3/src/win32_capture.c:1084:15: [2] (buffer) wchar_t: 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 const wchar_t prefix[6] = L"\\??\\X:"; data/wimlib-1.13.3/src/win32_capture.c:1091:2: [2] (buffer) wchar_t: 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. wchar_t tmp[(sizeof(prefix) + rel_target_nbytes) / sizeof(wchar_t)]; data/wimlib-1.13.3/src/win32_capture.c:1093: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(tmp, prefix, sizeof(prefix)); data/wimlib-1.13.3/src/win32_capture.c:1094: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(tmp + ARRAY_LEN(prefix), rel_target, rel_target_nbytes); data/wimlib-1.13.3/src/win32_capture.c:2046:2: [2] (buffer) wchar_t: 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. wchar_t FileName[1]; data/wimlib-1.13.3/src/win32_capture.c:2064:2: [2] (buffer) wchar_t: 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. wchar_t StreamIdentifier[1]; data/wimlib-1.13.3/src/win32_capture.c:2109:2: [2] (buffer) wchar_t: 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. wchar_t short_name[13]; data/wimlib-1.13.3/src/win32_capture.c:2123:2: [2] (buffer) wchar_t: 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. wchar_t name[0]; data/wimlib-1.13.3/src/win32_capture.c:2131:2: [2] (buffer) wchar_t: 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. wchar_t name[0]; data/wimlib-1.13.3/src/win32_capture.c:2379: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(ni->short_name, data/wimlib-1.13.3/src/win32_capture.c:2389: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(nd->name, name->FileName, name->FileNameLength); data/wimlib-1.13.3/src/win32_common.c:204:28: [2] (buffer) wchar_t: 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. win32_get_drive_path(const wchar_t *file_path, wchar_t drive_path[7]) data/wimlib-1.13.3/src/win32_common.c:204:48: [2] (buffer) wchar_t: 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. win32_get_drive_path(const wchar_t *file_path, wchar_t drive_path[7]) data/wimlib-1.13.3/src/win32_common.c:272:2: [2] (buffer) wchar_t: 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. wchar_t _buf[STACK_MAX / 8]; data/wimlib-1.13.3/src/win32_replacements.c:432:16: [2] (buffer) wchar_t: 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 const wchar_t orig_suffix[5] = L".orig"; data/wimlib-1.13.3/src/win32_vss.c:530:2: [2] (buffer) wchar_t: 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. wchar_t volume[4]; data/wimlib-1.13.3/src/write.c:1056: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(&ctx->cur_chunk_buf[ctx->cur_chunk_buf_filled], data/wimlib-1.13.3/src/write.c:2396: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(&checkpoint_hdr, &wim->out_hdr, sizeof(struct wim_header)); data/wimlib-1.13.3/src/write.c:3247:8: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). tchar tmpfile[wim_name_len + 10]; data/wimlib-1.13.3/src/write.c:3248:10: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). tmemcpy(tmpfile, wim->filename, wim_name_len); data/wimlib-1.13.3/src/write.c:3250:2: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). tmpfile[wim_name_len + 9] = T('\0'); data/wimlib-1.13.3/src/write.c:3252:26: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). ret = wimlib_write(wim, tmpfile, WIMLIB_ALL_IMAGES, data/wimlib-1.13.3/src/write.c:3258:11: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). tunlink(tmpfile); data/wimlib-1.13.3/src/write.c:3270:16: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). ret = trename(tmpfile, wim->filename); data/wimlib-1.13.3/src/write.c:3273:6: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). tmpfile, wim->filename); data/wimlib-1.13.3/src/write.c:3278:12: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). tunlink(tmpfile); data/wimlib-1.13.3/src/write.c:3284:25: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). progress.rename.from = tmpfile; data/wimlib-1.13.3/src/xml.c:307: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[32]; data/wimlib-1.13.3/src/xml.c:334: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[32]; data/wimlib-1.13.3/src/xml.c:396: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, path, n); data/wimlib-1.13.3/src/xml.c:555: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[32]; data/wimlib-1.13.3/src/xml.c:563: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(buf, "%d", info->image_count + 1); data/wimlib-1.13.3/src/xml_windows.c:275:14: [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 const char language_names[3149] = data/wimlib-1.13.3/tests/tree-cmp.c:150: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 buf1[4096], buf2[4096]; data/wimlib-1.13.3/tests/tree-cmp.c:152: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). fd1 = open(file1, O_RDONLY); data/wimlib-1.13.3/tests/tree-cmp.c:155: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). fd2 = open(file2, O_RDONLY); data/wimlib-1.13.3/tests/tree-cmp.c:235: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 _list1[256], _list2[sizeof(_list1)]; data/wimlib-1.13.3/tests/tree-cmp.c:376: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(file1 + file1_len + 1, name, name_len + 1); data/wimlib-1.13.3/tests/tree-cmp.c:377: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(file2 + file2_len + 1, name, name_len + 1); data/wimlib-1.13.3/tests/tree-cmp.c:390: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 buf1[4096], buf2[sizeof(buf1)]; data/wimlib-1.13.3/tests/tree-cmp.c:413: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 dir1[4096]; data/wimlib-1.13.3/tests/tree-cmp.c:414: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 dir2[4096]; data/wimlib-1.13.3/tests/wlfuzz.c:139: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[32768]; data/wimlib-1.13.3/tests/wlfuzz.c:162:15: [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 const char buffer[1] = {0}; data/wimlib-1.13.3/tests/wlfuzz.c:164: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(name, O_WRONLY|O_TRUNC|O_CREAT|O_NOFOLLOW, 0644); data/wimlib-1.13.3/tests/wlfuzz.c:819:2: [2] (buffer) wchar_t: 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. wchar_t volume[7]; data/wimlib-1.13.3/examples/compressfile.c:129:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). bytes_read = read(in_fd, ubuf, chunk_size); data/wimlib-1.13.3/examples/decompressfile.c:119:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). bytes_read = read(in_fd, &usize, sizeof(uint32_t)); data/wimlib-1.13.3/examples/decompressfile.c:124:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(in_fd, &csize, sizeof(uint32_t)) != sizeof(uint32_t)) data/wimlib-1.13.3/examples/decompressfile.c:134:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(in_fd, ubuf, usize) != (int32_t)usize) { data/wimlib-1.13.3/examples/decompressfile.c:139:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(in_fd, cbuf, csize) != (int32_t)csize) { data/wimlib-1.13.3/examples/decompressfile.c:197:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(in_fd, &ctype32, sizeof(uint32_t)) != sizeof(uint32_t) || data/wimlib-1.13.3/examples/decompressfile.c:198:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(in_fd, &chunk_size, sizeof(uint32_t)) != sizeof(uint32_t)) data/wimlib-1.13.3/include/wimlib_tchar.h:42:19: [1] (buffer) wcslen: 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). # define tstrlen wcslen data/wimlib-1.13.3/include/wimlib_tchar.h:104: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). # define tstrlen strlen data/wimlib-1.13.3/programs/wgetopt.c:411:21: [1] (buffer) wcslen: 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) wcslen (p->name)) data/wimlib-1.13.3/programs/wgetopt.c:435:16: [1] (buffer) wcslen: 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 += wcslen (nextchar); data/wimlib-1.13.3/programs/wgetopt.c:466:17: [1] (buffer) wcslen: 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 += wcslen (nextchar); data/wimlib-1.13.3/programs/wgetopt.c:482:17: [1] (buffer) wcslen: 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 += wcslen (nextchar); data/wimlib-1.13.3/programs/wgetopt.c:487:16: [1] (buffer) wcslen: 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 += wcslen (nextchar); data/wimlib-1.13.3/programs/wgetopt.c:598:51: [1] (buffer) wcslen: 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) == wcslen (p->name)) data/wimlib-1.13.3/programs/wgetopt.c:621:18: [1] (buffer) wcslen: 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 += wcslen (nextchar); data/wimlib-1.13.3/programs/wgetopt.c:641:19: [1] (buffer) wcslen: 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 += wcslen (nextchar); data/wimlib-1.13.3/programs/wgetopt.c:655:19: [1] (buffer) wcslen: 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 += wcslen (nextchar); data/wimlib-1.13.3/programs/wgetopt.c:659:18: [1] (buffer) wcslen: 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 += wcslen (nextchar); data/wimlib-1.13.3/src/extract.c:404: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). name = MALLOC(strlen(tmpdir) + 1 + 6 + 6 + 1); data/wimlib-1.13.3/src/file_io.c:35:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). # define read win32_read data/wimlib-1.13.3/src/file_io.c:54:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t ret = read(fd->fd, buf, count); data/wimlib-1.13.3/src/mount_image.c:223:21: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). mode &= ~fuse_ctx->umask; data/wimlib-1.13.3/src/mount_image.c:846: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). wim_basename_len = strlen(wim_basename); data/wimlib-1.13.3/src/mount_image.c:1324:8: [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(ctx->wim->filename)); data/wimlib-1.13.3/src/mount_image.c:2180:35: [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). ctx.mountpoint_abspath_nchars = strlen(ctx.mountpoint_abspath); data/wimlib-1.13.3/src/mount_image.c:2330:16: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask_save = umask(0); data/wimlib-1.13.3/src/mount_image.c:2337:3: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(umask_save); data/wimlib-1.13.3/src/reparse.c:284: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). size_t len = strlen(nt_root_dirs[i]); data/wimlib-1.13.3/src/reparse.c:347:33: [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). ret = tstr_to_utf16le(_target, strlen(_target), &target, &target_nbytes); data/wimlib-1.13.3/src/test_support.c:521:22: [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). entry->name_len = strlen(prefix) + name_len; data/wimlib-1.13.3/src/test_support.c:522:37: [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). p = mempcpy(entry->name, prefix, strlen(prefix)); data/wimlib-1.13.3/src/test_support.c:1233:8: [1] (buffer) mismatch: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. goto mismatch; data/wimlib-1.13.3/src/test_support.c:1239:9: [1] (buffer) mismatch: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. goto mismatch; data/wimlib-1.13.3/src/test_support.c:1248:8: [1] (buffer) mismatch: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. goto mismatch; data/wimlib-1.13.3/src/test_support.c:1258:8: [1] (buffer) mismatch: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. goto mismatch; data/wimlib-1.13.3/src/test_support.c:1265:8: [1] (buffer) mismatch: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. goto mismatch; data/wimlib-1.13.3/src/test_support.c:1275:8: [1] (buffer) mismatch: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. goto mismatch; data/wimlib-1.13.3/src/test_support.c:1279:1: [1] (buffer) mismatch: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. mismatch: data/wimlib-1.13.3/src/unix_apply.c:929:32: [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). ctx->target_abspath_nchars = strlen(ctx->target_abspath); data/wimlib-1.13.3/src/unix_capture.c:371:14: [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). name_len = strlen(entry->d_name); data/wimlib-1.13.3/src/util.c:106: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). return memdup(str, strlen(str) + 1); data/wimlib-1.13.3/src/util.c:113:22: [1] (buffer) wcslen: 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). return memdup(str, (wcslen(str) + 1) * sizeof(wchar_t)); data/wimlib-1.13.3/src/util.c:221:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int res = read(fd, p, min(n, INT_MAX)); data/wimlib-1.13.3/src/wimboot.c:492:7: [1] (buffer) wcslen: 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). ((wcslen(wim_path) - 2 + 1) * sizeof(wchar_t)); data/wimlib-1.13.3/src/wimboot.c:907:20: [1] (buffer) wcslen: 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). wim_path_nchars = wcslen(wim_path); data/wimlib-1.13.3/src/win32_apply.c:2104:16: [1] (buffer) wcslen: 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 = wcslen(dirs[i]); data/wimlib-1.13.3/src/win32_capture.c:2152:6: [1] (buffer) wcslen: 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). (wcslen((nd)->name) + 1) * sizeof(wchar_t)) data/wimlib-1.13.3/src/win32_capture.c:2156:6: [1] (buffer) wcslen: 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). (wcslen((ns)->name) + 1) * sizeof(wchar_t)) data/wimlib-1.13.3/src/win32_capture.c:2536:28: [1] (buffer) wcslen: 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). status = winnt_open(path, wcslen(path), data/wimlib-1.13.3/src/win32_capture.c:2782:19: [1] (buffer) wcslen: 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 nbytes = wcslen(ni->short_name) * sizeof(wchar_t); data/wimlib-1.13.3/src/win32_capture.c:2858:10: [1] (buffer) wcslen: 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). wcslen(ns->name), data/wimlib-1.13.3/src/win32_capture.c:2892:8: [1] (buffer) wcslen: 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). wcslen(nd->name), data/wimlib-1.13.3/src/win32_replacements.c:436:19: [1] (buffer) wcslen: 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 dstlen = wcslen(dstpath); data/wimlib-1.13.3/src/win32_replacements.c:683:25: [1] (buffer) wcslen: 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 filename_len = wcslen(dat.cFileName); data/wimlib-1.13.3/src/win32_vss.c:586:4: [1] (buffer) wcslen: 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). (wcslen(snapshot->props.m_pwszSnapshotDeviceObject) + data/wimlib-1.13.3/src/win32_vss.c:587:8: [1] (buffer) wcslen: 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). 1 + wcslen(&source_abspath[3]) + 1); data/wimlib-1.13.3/src/xml.c:184:25: [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 (utf8_to_tstr(text, strlen(text), ttext_p, NULL)) data/wimlib-1.13.3/src/xml.c:385: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). size_t n = strlen(path) + 1; data/wimlib-1.13.3/src/xml_windows.c:537: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). size_t len = strlen(language_name); data/wimlib-1.13.3/tests/tree-cmp.c:161:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd1, buf1, to_read) != to_read) data/wimlib-1.13.3/tests/tree-cmp.c:163:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd2, buf2, to_read) != to_read) data/wimlib-1.13.3/tests/tree-cmp.c:271:8: [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). p += strlen(p) + 1; data/wimlib-1.13.3/tests/tree-cmp.c:371: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). name_len = strlen(name); data/wimlib-1.13.3/tests/tree-cmp.c:419: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). tree_cmp(dir1, strlen(dir1), dir2, strlen(dir2)); data/wimlib-1.13.3/tests/tree-cmp.c:419:37: [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). tree_cmp(dir1, strlen(dir1), dir2, strlen(dir2)); data/wimlib-1.13.3/tests/wlfuzz.c:144:23: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((bytes_read = read(in_fd, buf, sizeof(buf))) > 0) { ANALYSIS SUMMARY: Hits = 284 Lines analyzed = 77150 in approximately 1.94 seconds (39689 lines/second) Physical Source Lines of Code (SLOC) = 48877 Hits@level = [0] 88 [1] 67 [2] 156 [3] 18 [4] 39 [5] 4 Hits@level+ = [0+] 372 [1+] 284 [2+] 217 [3+] 61 [4+] 43 [5+] 4 Hits/KSLOC@level+ = [0+] 7.61094 [1+] 5.8105 [2+] 4.43972 [3+] 1.24803 [4+] 0.879759 [5+] 0.0818381 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.