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/gparted-1.1.0/include/OperationCreate.h Examining data/gparted-1.1.0/include/HBoxOperations.h Examining data/gparted-1.1.0/include/udf.h Examining data/gparted-1.1.0/include/Dialog_Partition_Copy.h Examining data/gparted-1.1.0/include/Dialog_Partition_Resize_Move.h Examining data/gparted-1.1.0/include/reiser4.h Examining data/gparted-1.1.0/include/TreeView_Detail.h Examining data/gparted-1.1.0/include/OperationDetail.h Examining data/gparted-1.1.0/include/DialogPasswordEntry.h Examining data/gparted-1.1.0/include/PasswordRAMStore.h Examining data/gparted-1.1.0/include/DialogManageFlags.h Examining data/gparted-1.1.0/include/BlockSpecial.h Examining data/gparted-1.1.0/include/OperationFormat.h Examining data/gparted-1.1.0/include/Dialog_Base_Partition.h Examining data/gparted-1.1.0/include/lvm2_pv.h Examining data/gparted-1.1.0/include/Dialog_Partition_Name.h Examining data/gparted-1.1.0/include/Device.h Examining data/gparted-1.1.0/include/OperationResizeMove.h Examining data/gparted-1.1.0/include/luks.h Examining data/gparted-1.1.0/include/OperationCopy.h Examining data/gparted-1.1.0/include/linux_swap.h Examining data/gparted-1.1.0/include/SupportedFileSystems.h Examining data/gparted-1.1.0/include/hfsplus.h Examining data/gparted-1.1.0/include/GParted_Core.h Examining data/gparted-1.1.0/include/btrfs.h Examining data/gparted-1.1.0/include/Win_GParted.h Examining data/gparted-1.1.0/include/ntfs.h Examining data/gparted-1.1.0/include/Operation.h Examining data/gparted-1.1.0/include/Dialog_Progress.h Examining data/gparted-1.1.0/include/Mount_Info.h Examining data/gparted-1.1.0/include/Frame_Resizer_Extended.h Examining data/gparted-1.1.0/include/PipeCapture.h Examining data/gparted-1.1.0/include/OperationChangeUUID.h Examining data/gparted-1.1.0/include/Frame_Resizer_Base.h Examining data/gparted-1.1.0/include/xfs.h Examining data/gparted-1.1.0/include/FileSystem.h Examining data/gparted-1.1.0/include/minix.h Examining data/gparted-1.1.0/include/LVM2_PV_Info.h Examining data/gparted-1.1.0/include/OptionComboBox.h Examining data/gparted-1.1.0/include/Dialog_Partition_New.h Examining data/gparted-1.1.0/include/f2fs.h Examining data/gparted-1.1.0/include/DialogFeatures.h Examining data/gparted-1.1.0/include/fat16.h Examining data/gparted-1.1.0/include/OperationLabelFileSystem.h Examining data/gparted-1.1.0/include/OperationDelete.h Examining data/gparted-1.1.0/include/OperationNamePartition.h Examining data/gparted-1.1.0/include/hfs.h Examining data/gparted-1.1.0/include/ext2.h Examining data/gparted-1.1.0/include/Dialog_Rescue_Data.h Examining data/gparted-1.1.0/include/exfat.h Examining data/gparted-1.1.0/include/ProgressBar.h Examining data/gparted-1.1.0/include/nilfs2.h Examining data/gparted-1.1.0/include/PartitionVector.h Examining data/gparted-1.1.0/include/Partition.h Examining data/gparted-1.1.0/include/Proc_Partitions_Info.h Examining data/gparted-1.1.0/include/reiserfs.h Examining data/gparted-1.1.0/include/Dialog_Partition_Info.h Examining data/gparted-1.1.0/include/DrawingAreaVisualDisk.h Examining data/gparted-1.1.0/include/SWRaid_Info.h Examining data/gparted-1.1.0/include/Dialog_Disklabel.h Examining data/gparted-1.1.0/include/DMRaid.h Examining data/gparted-1.1.0/include/CopyBlocks.h Examining data/gparted-1.1.0/include/FS_Info.h Examining data/gparted-1.1.0/include/PartitionLUKS.h Examining data/gparted-1.1.0/include/LUKS_Info.h Examining data/gparted-1.1.0/include/Utils.h Examining data/gparted-1.1.0/include/Dialog_FileSystem_Label.h Examining data/gparted-1.1.0/include/MenuHelpers.h Examining data/gparted-1.1.0/include/i18n.h Examining data/gparted-1.1.0/include/jfs.h Examining data/gparted-1.1.0/include/OperationCheck.h Examining data/gparted-1.1.0/lib/gtest/include/gtest/gtest_prod.h Examining data/gparted-1.1.0/lib/gtest/include/gtest/gtest.h Examining data/gparted-1.1.0/lib/gtest/include/gtest/gtest-death-test.h Examining data/gparted-1.1.0/lib/gtest/include/gtest/gtest-typed-test.h Examining data/gparted-1.1.0/lib/gtest/include/gtest/gtest-printers.h Examining data/gparted-1.1.0/lib/gtest/include/gtest/gtest-spi.h Examining data/gparted-1.1.0/lib/gtest/include/gtest/gtest-message.h Examining data/gparted-1.1.0/lib/gtest/include/gtest/gtest-test-part.h Examining data/gparted-1.1.0/lib/gtest/include/gtest/internal/gtest-type-util.h Examining data/gparted-1.1.0/lib/gtest/include/gtest/internal/gtest-param-util-generated.h Examining data/gparted-1.1.0/lib/gtest/include/gtest/internal/gtest-death-test-internal.h Examining data/gparted-1.1.0/lib/gtest/include/gtest/internal/gtest-param-util.h Examining data/gparted-1.1.0/lib/gtest/include/gtest/internal/gtest-tuple.h Examining data/gparted-1.1.0/lib/gtest/include/gtest/internal/gtest-linked_ptr.h Examining data/gparted-1.1.0/lib/gtest/include/gtest/internal/gtest-port-arch.h Examining data/gparted-1.1.0/lib/gtest/include/gtest/internal/custom/gtest.h Examining data/gparted-1.1.0/lib/gtest/include/gtest/internal/custom/gtest-printers.h Examining data/gparted-1.1.0/lib/gtest/include/gtest/internal/custom/gtest-port.h Examining data/gparted-1.1.0/lib/gtest/include/gtest/internal/gtest-filepath.h Examining data/gparted-1.1.0/lib/gtest/include/gtest/internal/gtest-internal.h Examining data/gparted-1.1.0/lib/gtest/include/gtest/internal/gtest-string.h Examining data/gparted-1.1.0/lib/gtest/include/gtest/internal/gtest-port.h Examining data/gparted-1.1.0/lib/gtest/include/gtest/gtest-param-test.h Examining data/gparted-1.1.0/lib/gtest/include/gtest/gtest_pred_impl.h Examining data/gparted-1.1.0/lib/gtest/src/gtest-typed-test.cc Examining data/gparted-1.1.0/lib/gtest/src/gtest_main.cc Examining data/gparted-1.1.0/lib/gtest/src/gtest-test-part.cc Examining data/gparted-1.1.0/lib/gtest/src/gtest-all.cc Examining data/gparted-1.1.0/lib/gtest/src/gtest-death-test.cc Examining data/gparted-1.1.0/lib/gtest/src/gtest.cc Examining data/gparted-1.1.0/lib/gtest/src/gtest-internal-inl.h Examining data/gparted-1.1.0/lib/gtest/src/gtest-filepath.cc Examining data/gparted-1.1.0/lib/gtest/src/gtest-port.cc Examining data/gparted-1.1.0/lib/gtest/src/gtest-printers.cc Examining data/gparted-1.1.0/src/CopyBlocks.cc Examining data/gparted-1.1.0/src/DialogPasswordEntry.cc Examining data/gparted-1.1.0/src/Dialog_Rescue_Data.cc Examining data/gparted-1.1.0/src/DrawingAreaVisualDisk.cc Examining data/gparted-1.1.0/src/f2fs.cc Examining data/gparted-1.1.0/src/SupportedFileSystems.cc Examining data/gparted-1.1.0/src/DialogManageFlags.cc Examining data/gparted-1.1.0/src/hfsplus.cc Examining data/gparted-1.1.0/src/PipeCapture.cc Examining data/gparted-1.1.0/src/LVM2_PV_Info.cc Examining data/gparted-1.1.0/src/Dialog_Disklabel.cc Examining data/gparted-1.1.0/src/PasswordRAMStore.cc Examining data/gparted-1.1.0/src/MenuHelpers.cc Examining data/gparted-1.1.0/src/Dialog_Partition_Copy.cc Examining data/gparted-1.1.0/src/OptionComboBox.cc Examining data/gparted-1.1.0/src/GParted_Core.cc Examining data/gparted-1.1.0/src/reiser4.cc Examining data/gparted-1.1.0/src/Dialog_FileSystem_Label.cc Examining data/gparted-1.1.0/src/hfs.cc Examining data/gparted-1.1.0/src/DialogFeatures.cc Examining data/gparted-1.1.0/src/Utils.cc Examining data/gparted-1.1.0/src/BlockSpecial.cc Examining data/gparted-1.1.0/src/OperationLabelFileSystem.cc Examining data/gparted-1.1.0/src/Frame_Resizer_Base.cc Examining data/gparted-1.1.0/src/OperationDelete.cc Examining data/gparted-1.1.0/src/OperationDetail.cc Examining data/gparted-1.1.0/src/Frame_Resizer_Extended.cc Examining data/gparted-1.1.0/src/OperationCopy.cc Examining data/gparted-1.1.0/src/lvm2_pv.cc Examining data/gparted-1.1.0/src/ntfs.cc Examining data/gparted-1.1.0/src/FS_Info.cc Examining data/gparted-1.1.0/src/fat16.cc Examining data/gparted-1.1.0/src/PartitionLUKS.cc Examining data/gparted-1.1.0/src/main.cc Examining data/gparted-1.1.0/src/OperationNamePartition.cc Examining data/gparted-1.1.0/src/Mount_Info.cc Examining data/gparted-1.1.0/src/ext2.cc Examining data/gparted-1.1.0/src/xfs.cc Examining data/gparted-1.1.0/src/OperationResizeMove.cc Examining data/gparted-1.1.0/src/FileSystem.cc Examining data/gparted-1.1.0/src/OperationFormat.cc Examining data/gparted-1.1.0/src/DMRaid.cc Examining data/gparted-1.1.0/src/udf.cc Examining data/gparted-1.1.0/src/Win_GParted.cc Examining data/gparted-1.1.0/src/exfat.cc Examining data/gparted-1.1.0/src/Dialog_Partition_New.cc Examining data/gparted-1.1.0/src/linux_swap.cc Examining data/gparted-1.1.0/src/Device.cc Examining data/gparted-1.1.0/src/Dialog_Base_Partition.cc Examining data/gparted-1.1.0/src/reiserfs.cc Examining data/gparted-1.1.0/src/TreeView_Detail.cc Examining data/gparted-1.1.0/src/Dialog_Partition_Info.cc Examining data/gparted-1.1.0/src/Dialog_Partition_Name.cc Examining data/gparted-1.1.0/src/btrfs.cc Examining data/gparted-1.1.0/src/LUKS_Info.cc Examining data/gparted-1.1.0/src/Dialog_Progress.cc Examining data/gparted-1.1.0/src/SWRaid_Info.cc Examining data/gparted-1.1.0/src/luks.cc Examining data/gparted-1.1.0/src/jfs.cc Examining data/gparted-1.1.0/src/OperationChangeUUID.cc Examining data/gparted-1.1.0/src/OperationCheck.cc Examining data/gparted-1.1.0/src/minix.cc Examining data/gparted-1.1.0/src/Dialog_Partition_Resize_Move.cc Examining data/gparted-1.1.0/src/Partition.cc Examining data/gparted-1.1.0/src/OperationCreate.cc Examining data/gparted-1.1.0/src/Operation.cc Examining data/gparted-1.1.0/src/ProgressBar.cc Examining data/gparted-1.1.0/src/nilfs2.cc Examining data/gparted-1.1.0/src/Proc_Partitions_Info.cc Examining data/gparted-1.1.0/src/HBoxOperations.cc Examining data/gparted-1.1.0/src/PartitionVector.cc Examining data/gparted-1.1.0/tests/test_dummy.cc Examining data/gparted-1.1.0/tests/test_BlockSpecial.cc Examining data/gparted-1.1.0/tests/test_PipeCapture.cc Examining data/gparted-1.1.0/tests/test_PasswordRAMStore.cc Examining data/gparted-1.1.0/tests/test_SupportedFileSystems.cc FINAL RESULTS: data/gparted-1.1.0/lib/gtest/include/gtest/internal/gtest-death-test-internal.h:169:5: [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(\ data/gparted-1.1.0/lib/gtest/include/gtest/internal/gtest-port.h:2503:20: [4] (buffer) StrNCpy: 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). inline const char* StrNCpy(char* dest, const char* src, size_t n) { data/gparted-1.1.0/lib/gtest/include/gtest/internal/gtest-port.h:2574:26: [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 GTEST_SNPRINTF_ _snprintf data/gparted-1.1.0/lib/gtest/include/gtest/internal/gtest-port.h:2576:26: [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 GTEST_SNPRINTF_ snprintf data/gparted-1.1.0/lib/gtest/src/gtest.cc:138:10: [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 _vsnprintf data/gparted-1.1.0/lib/gtest/src/gtest.cc:3039:5: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vprintf(fmt, args); data/gparted-1.1.0/lib/gtest/src/gtest.cc:3060:3: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vprintf(fmt, args); data/gparted-1.1.0/lib/gtest/src/gtest.cc:3067:3: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vprintf(fmt, args); data/gparted-1.1.0/tests/test_SupportedFileSystems.cc:713:2: [4] (shell) execvp: 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. execvp(new_argv[0], new_argv); data/gparted-1.1.0/lib/gtest/include/gtest/gtest.h:966:39: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. void ShuffleTests(internal::Random* random); data/gparted-1.1.0/lib/gtest/include/gtest/internal/gtest-port.h:2542:27: [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* const env = getenv(name); data/gparted-1.1.0/lib/gtest/include/gtest/internal/gtest-port.h:2545:10: [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. return getenv(name); data/gparted-1.1.0/lib/gtest/src/gtest-internal-inl.h:308:37: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. void ShuffleRange(internal::Random* random, int begin, int end, data/gparted-1.1.0/lib/gtest/src/gtest-internal-inl.h:329:39: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. inline void Shuffle(internal::Random* random, std::vector<E>* v) { data/gparted-1.1.0/lib/gtest/src/gtest-internal-inl.h:330:16: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. ShuffleRange(random, 0, static_cast<int>(v->size()), v); data/gparted-1.1.0/lib/gtest/src/gtest-internal-inl.h:796:21: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. internal::Random* random() { return &random_; } data/gparted-1.1.0/lib/gtest/src/gtest-port.cc:258:5: [3] (misc) InitializeCriticalSection: Exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. ::InitializeCriticalSection(critical_section_); data/gparted-1.1.0/lib/gtest/src/gtest-port.cc:276:5: [3] (misc) EnterCriticalSection: On some versions of Windows, exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. ::EnterCriticalSection(critical_section_); data/gparted-1.1.0/lib/gtest/src/gtest-port.cc:349:11: [3] (misc) InitializeCriticalSection: Exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. ::InitializeCriticalSection(critical_section_); data/gparted-1.1.0/lib/gtest/src/gtest.cc:2830:47: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. void TestCase::ShuffleTests(internal::Random* random) { data/gparted-1.1.0/lib/gtest/src/gtest.cc:2831:11: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. Shuffle(random, &test_indices_); data/gparted-1.1.0/lib/gtest/src/gtest.cc:5155:7: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. random()->Reseed(random_seed_); data/gparted-1.1.0/lib/gtest/src/gtest.cc:5505:16: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. ShuffleRange(random(), 0, last_death_test_case_ + 1, &test_case_indices_); data/gparted-1.1.0/lib/gtest/src/gtest.cc:5508:16: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. ShuffleRange(random(), last_death_test_case_ + 1, data/gparted-1.1.0/lib/gtest/src/gtest.cc:5513:34: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. test_cases_[i]->ShuffleTests(random()); data/gparted-1.1.0/src/DMRaid.cc:166: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. char * rpath = realpath( dev_path.c_str(), NULL ); data/gparted-1.1.0/src/DMRaid.cc:236: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. char * rpath = realpath( dev_path.c_str(), NULL ); data/gparted-1.1.0/tests/test_BlockSpecial.cc:167: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. char * rpath = realpath( link.c_str(), NULL ); data/gparted-1.1.0/tests/test_SupportedFileSystems.cc:728:24: [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* display = getenv("DISPLAY"); data/gparted-1.1.0/lib/gtest/include/gtest/internal/gtest-port.h:2515: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). return fopen(path, mode); data/gparted-1.1.0/lib/gtest/src/gtest-death-test.cc:341: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 buffer[256]; data/gparted-1.1.0/lib/gtest/src/gtest-death-test.cc:762: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 executable_path[_MAX_PATH + 1]; // NOLINT data/gparted-1.1.0/lib/gtest/src/gtest-death-test.cc:1243:22: [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). const int cwd_fd = open(".", O_RDONLY); data/gparted-1.1.0/lib/gtest/src/gtest-filepath.cc:103: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 cwd[GTEST_PATH_MAX_ + 1] = { '\0' }; data/gparted-1.1.0/lib/gtest/src/gtest-filepath.cc:106: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 cwd[GTEST_PATH_MAX_ + 1] = { '\0' }; data/gparted-1.1.0/lib/gtest/src/gtest-port.cc:135: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). const int fd = open("/proc/self/as", O_RDONLY); data/gparted-1.1.0/lib/gtest/src/gtest-port.cc:922: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, regex, len); data/gparted-1.1.0/lib/gtest/src/gtest-port.cc:996:5: [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 temp_dir_path[MAX_PATH + 1] = { '\0' }; // NOLINT data/gparted-1.1.0/lib/gtest/src/gtest-port.cc:997:5: [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 temp_file_path[MAX_PATH + 1] = { '\0' }; // NOLINT data/gparted-1.1.0/lib/gtest/src/gtest-port.cc:1034:29: [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). const int captured_fd = mkstemp(name_template); data/gparted-1.1.0/lib/gtest/src/gtest-printers.cc:65: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 text[5] = ""; data/gparted-1.1.0/lib/gtest/src/gtest.cc:906:7: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). MultiByteToWideChar(CP_ACP, 0, ansi, length, data/gparted-1.1.0/lib/gtest/src/gtest.cc:909:3: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). MultiByteToWideChar(CP_ACP, 0, ansi, length, data/gparted-1.1.0/lib/gtest/src/gtest.cc:1725: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 error_text[kBufSize] = { '\0' }; data/gparted-1.1.0/lib/gtest/src/gtest.cc:1809: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 str[5]; // Big enough for the largest valid code point. data/gparted-1.1.0/lib/gtest/src/gtest.cc:4343:5: [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[1024]; data/gparted-1.1.0/lib/gtest/src/gtest.cc:4349:5: [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 line[1024]; data/gparted-1.1.0/src/DMRaid.cc:274:14: [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). return std::atoi( Utils::regexp_label( partition_name, dmraid_name + "p?([0-9]+)" ) .c_str() ) ; data/gparted-1.1.0/src/Dialog_Rescue_Data.cc:164: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 tmpDir[32]=tmp_prefix; data/gparted-1.1.0/src/FileSystem.cc:208: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 dir_buf[4096+1]; data/gparted-1.1.0/src/FileSystem.cc:209: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( dir_buf, "%.*s", (int) sizeof(dir_buf)-1, dir_template .c_str() ) ; data/gparted-1.1.0/src/GParted_Core.cc:1082: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 magic1[16]; // Big enough for largest signatures[].sig1 or sig2 data/gparted-1.1.0/src/GParted_Core.cc:1083: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 magic2[16]; data/gparted-1.1.0/src/GParted_Core.cc:1090: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(path.c_str(), O_RDONLY|O_NONBLOCK); data/gparted-1.1.0/src/GParted_Core.cc:1173: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(magic1, buf + signatures[i].offset1 % sector_size, len1); data/gparted-1.1.0/src/GParted_Core.cc:1177: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(magic2, buf + signatures[i].offset2 % sector_size, len2); data/gparted-1.1.0/src/GParted_Core.cc:3915: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[4] ; data/gparted-1.1.0/src/GParted_Core.cc:3925: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). dev_file .open( partition .get_path() .c_str(), std::ios::out | std::ios::binary ) ; data/gparted-1.1.0/src/GParted_Core.cc:3999: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(lp_device->path, O_RDONLY|O_NONBLOCK); data/gparted-1.1.0/src/PasswordRAMStore.cc: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( next_password, password, pw_len ); data/gparted-1.1.0/src/PipeCapture.cc:148: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( readbuf, read_ptr, bytes_remaining ); data/gparted-1.1.0/src/PipeCapture.cc:253: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[MAX_UTF8_BYTES]; data/gparted-1.1.0/src/Utils.cc:471: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). input .open( "/proc/filesystems" ) ; data/gparted-1.1.0/src/Utils.cc:488: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). input .open( "/proc/filesystems" ) ; data/gparted-1.1.0/src/Utils.cc:884: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 uuid_str[UUID_STRING_LENGTH+1]; data/gparted-1.1.0/tests/test_BlockSpecial.cc:110: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[100] = ""; data/gparted-1.1.0/tests/test_PasswordRAMStore.cc:52: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 buf[14]; data/gparted-1.1.0/tests/test_PasswordRAMStore.cc:60: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 buf[21]; data/gparted-1.1.0/tests/test_SupportedFileSystems.cc:301: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(s_image_name, O_WRONLY|O_CREAT|O_NONBLOCK, 0666); data/gparted-1.1.0/tests/test_SupportedFileSystems.cc:463: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(s_image_name, O_WRONLY|O_NONBLOCK); data/gparted-1.1.0/include/FileSystem.h:66:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). Support read; // Can and how to read sector usage while inactive data/gparted-1.1.0/lib/gtest/include/gtest/internal/gtest-port.h:2504:10: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). return strncpy(dest, src, n); data/gparted-1.1.0/lib/gtest/include/gtest/internal/gtest-port.h:2526:27: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). return static_cast<int>(read(fd, buf, count)); data/gparted-1.1.0/lib/gtest/include/gtest/internal/gtest-type-util.h:67: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). if (s.compare(0, strlen(prefix), prefix) == 0) { data/gparted-1.1.0/lib/gtest/include/gtest/internal/gtest-type-util.h:68:47: [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). std::string::size_type end = s.find("::", strlen(prefix)); data/gparted-1.1.0/lib/gtest/include/gtest/internal/gtest-type-util.h:71: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). s.erase(strlen("std"), end - strlen("std")); data/gparted-1.1.0/lib/gtest/include/gtest/internal/gtest-type-util.h:71:36: [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). s.erase(strlen("std"), end - strlen("std")); data/gparted-1.1.0/lib/gtest/src/gtest-port.cc:656: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). const size_t full_regex_len = strlen(regex) + 10; data/gparted-1.1.0/lib/gtest/src/gtest-port.cc:910: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). const size_t len = strlen(regex); data/gparted-1.1.0/lib/gtest/src/gtest-printers.cc:334:29: [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). PrintCharsAsStringTo(s, strlen(s), os); data/gparted-1.1.0/lib/gtest/src/gtest-printers.cc:351:34: [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). PrintCharsAsStringTo(s, std::wcslen(s), os); data/gparted-1.1.0/lib/gtest/src/gtest.cc:904: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). const int length = strlen(ansi); data/gparted-1.1.0/lib/gtest/src/gtest.cc:1870:34: [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). num_chars = static_cast<int>(wcslen(str)); data/gparted-1.1.0/lib/gtest/src/gtest.cc:3662: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). segment = next_segment + strlen("]]>"); data/gparted-1.1.0/lib/gtest/src/gtest.cc:4247: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). result.reserve(strlen(str) + 1); data/gparted-1.1.0/lib/gtest/src/gtest.cc:5566:29: [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). const size_t prefix_len = strlen(prefix); data/gparted-1.1.0/lib/gtest/src/gtest.cc:5977: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). else if (temp_dir[strlen(temp_dir) - 1] == '\\') data/gparted-1.1.0/src/GParted_Core.cc:1145:71: [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). const size_t len1 = std::min( ( signatures[i].sig1 == NULL ) ? 0U : strlen( signatures[i].sig1 ), data/gparted-1.1.0/src/GParted_Core.cc:1147:71: [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). const size_t len2 = std::min( ( signatures[i].sig2 == NULL ) ? 0U : strlen( signatures[i].sig2 ), data/gparted-1.1.0/src/GParted_Core.cc:1162:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(fd, buf, sector_size) == sector_size ) data/gparted-1.1.0/src/GParted_Core.cc:1577:36: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). switch(get_fs(partition.fstype).read) data/gparted-1.1.0/src/GParted_Core.cc:4002:24: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t bytes_read = read(fd, buf, lp_device->sector_size); data/gparted-1.1.0/src/PasswordRAMStore.cc:122: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 pw_len = strlen( password ); data/gparted-1.1.0/src/PipeCapture.cc:120:35: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). Glib::IOStatus status = channel->read( readbuf + fill_offset, READBUF_SIZE - fill_offset, bytes_read ); data/gparted-1.1.0/src/Utils.cc:715: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). size_t len = strlen( input ); data/gparted-1.1.0/src/Win_GParted.cc:2621: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). if ( strlen( pw ) == 0 ) data/gparted-1.1.0/src/btrfs.cc:79:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ( fs .read ) //needed to determine a minimum file system size. data/gparted-1.1.0/src/ext2.cc:110:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ( fs.read ) // Needed to determine a min file system size.. data/gparted-1.1.0/src/nilfs2.cc:58:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ( fs .read ) //needed to determine a minimum file system size. data/gparted-1.1.0/src/ntfs.cc:87:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ( fs .read ) //needed to determine a min file system size.. data/gparted-1.1.0/src/reiserfs.cc:62:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ( fs .read ) //needed to determine a min file system size.. data/gparted-1.1.0/tests/test_BlockSpecial.cc:114:8: [1] (buffer) sscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. if ( sscanf( line.c_str(), "%*u %*u %*u %99s", name ) == 1 ) data/gparted-1.1.0/tests/test_PasswordRAMStore.cc:135: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). looked_up_len = strlen( looked_up_pw ); data/gparted-1.1.0/tests/test_PasswordRAMStore.cc:154: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). looked_up_len = strlen( looked_up_pw ); data/gparted-1.1.0/tests/test_PasswordRAMStore.cc:178: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). looked_up_len = strlen( looked_up_pw ); data/gparted-1.1.0/tests/test_PasswordRAMStore.cc:207: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). looked_up_len = strlen( looked_up_pw ); data/gparted-1.1.0/tests/test_PasswordRAMStore.cc:237: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). looked_up_len = strlen( looked_up_pw ); data/gparted-1.1.0/tests/test_PasswordRAMStore.cc:256: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). looked_up_len = strlen( looked_up_pw ); data/gparted-1.1.0/tests/test_SupportedFileSystems.cc:497:28: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). SKIP_IF_FS_DOESNT_SUPPORT(read); data/gparted-1.1.0/tests/test_SupportedFileSystems.cc:705:26: [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 long)strlen(new_argv[0])+1, errno, strerror(errno)); ANALYSIS SUMMARY: Hits = 110 Lines analyzed = 65900 in approximately 1.61 seconds (41019 lines/second) Physical Source Lines of Code (SLOC) = 43682 Hits@level = [0] 108 [1] 40 [2] 41 [3] 20 [4] 9 [5] 0 Hits@level+ = [0+] 218 [1+] 110 [2+] 70 [3+] 29 [4+] 9 [5+] 0 Hits/KSLOC@level+ = [0+] 4.99061 [1+] 2.5182 [2+] 1.60249 [3+] 0.663889 [4+] 0.206035 [5+] 0 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.