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/gsmartcontrol-1.1.3/src/gsc_executor_log_window.cpp Examining data/gsmartcontrol-1.1.3/src/gsc_preferences_window.h Examining data/gsmartcontrol-1.1.3/src/rmn/resource_data_locking.h Examining data/gsmartcontrol-1.1.3/src/rmn/resource_base.h Examining data/gsmartcontrol-1.1.3/src/rmn/resource_exception.h Examining data/gsmartcontrol-1.1.3/src/rmn/resource_node_dump.h Examining data/gsmartcontrol-1.1.3/src/rmn/rmn_test.cpp Examining data/gsmartcontrol-1.1.3/src/rmn/rmn.h Examining data/gsmartcontrol-1.1.3/src/rmn/resource_data_types.h Examining data/gsmartcontrol-1.1.3/src/rmn/resource_node.h Examining data/gsmartcontrol-1.1.3/src/rmn/resource_data_one.h Examining data/gsmartcontrol-1.1.3/src/rmn/resource_data_any.h Examining data/gsmartcontrol-1.1.3/src/rmn/resource_serialization.h Examining data/gsmartcontrol-1.1.3/src/hz/win32_tools.h Examining data/gsmartcontrol-1.1.3/src/hz/tls_policy_glib.h Examining data/gsmartcontrol-1.1.3/src/hz/common_types.h Examining data/gsmartcontrol-1.1.3/src/hz/static_assert.h Examining data/gsmartcontrol-1.1.3/src/hz/sync_policy_glib.h Examining data/gsmartcontrol-1.1.3/src/hz/fs_file_test.cpp Examining data/gsmartcontrol-1.1.3/src/hz/string_wcmatch.h Examining data/gsmartcontrol-1.1.3/src/hz/type_properties.h Examining data/gsmartcontrol-1.1.3/src/hz/bad_cast_exception.h Examining data/gsmartcontrol-1.1.3/src/hz/sync_policy_pthread.h Examining data/gsmartcontrol-1.1.3/src/hz/system_specific.h Examining data/gsmartcontrol-1.1.3/src/hz/cstdint_impl_msvc.h Examining data/gsmartcontrol-1.1.3/src/hz/tls_policy_boost.h Examining data/gsmartcontrol-1.1.3/src/hz/sync_lock_ptr.h Examining data/gsmartcontrol-1.1.3/src/hz/data_file.h Examining data/gsmartcontrol-1.1.3/src/hz/format_unit.h Examining data/gsmartcontrol-1.1.3/src/hz/any_type_holder.h Examining data/gsmartcontrol-1.1.3/src/hz/string_algo_test.cpp Examining data/gsmartcontrol-1.1.3/src/hz/ptr_container.h Examining data/gsmartcontrol-1.1.3/src/hz/i18n.h Examining data/gsmartcontrol-1.1.3/src/hz/fs_dir.h Examining data/gsmartcontrol-1.1.3/src/hz/sync.h Examining data/gsmartcontrol-1.1.3/src/hz/fs_path_test.cpp Examining data/gsmartcontrol-1.1.3/src/hz/errno_string_test.cpp Examining data/gsmartcontrol-1.1.3/src/hz/intrusive_ptr.h Examining data/gsmartcontrol-1.1.3/src/hz/tls_policy_win32.h Examining data/gsmartcontrol-1.1.3/src/hz/error_holder.h Examining data/gsmartcontrol-1.1.3/src/hz/ascii.h Examining data/gsmartcontrol-1.1.3/src/hz/any_convert.h Examining data/gsmartcontrol-1.1.3/src/hz/fs_error_holder.h Examining data/gsmartcontrol-1.1.3/src/hz/env_tools.h Examining data/gsmartcontrol-1.1.3/src/hz/scoped_array.h Examining data/gsmartcontrol-1.1.3/src/hz/error.h Examining data/gsmartcontrol-1.1.3/src/hz/errno_string.h Examining data/gsmartcontrol-1.1.3/src/hz/fs_dir_platform.h Examining data/gsmartcontrol-1.1.3/src/hz/type_categories.h Examining data/gsmartcontrol-1.1.3/src/hz/string_sprintf.h Examining data/gsmartcontrol-1.1.3/src/hz/cstdint.h Examining data/gsmartcontrol-1.1.3/src/hz/sync_policy_boost.h Examining data/gsmartcontrol-1.1.3/src/hz/tls_test.cpp Examining data/gsmartcontrol-1.1.3/src/hz/fs_common.h Examining data/gsmartcontrol-1.1.3/src/hz/exceptions.h Examining data/gsmartcontrol-1.1.3/src/hz/fs_file.h Examining data/gsmartcontrol-1.1.3/src/hz/sync_multilock_test.cpp Examining data/gsmartcontrol-1.1.3/src/hz/string_algo.h Examining data/gsmartcontrol-1.1.3/src/hz/format_unit_test.cpp Examining data/gsmartcontrol-1.1.3/src/hz/launch_url.h Examining data/gsmartcontrol-1.1.3/src/hz/string_num.h Examining data/gsmartcontrol-1.1.3/src/hz/string_wcmatch_test.cpp Examining data/gsmartcontrol-1.1.3/src/hz/any_type.h Examining data/gsmartcontrol-1.1.3/src/hz/tls.h Examining data/gsmartcontrol-1.1.3/src/hz/sync_part_get_policy.h Examining data/gsmartcontrol-1.1.3/src/hz/noncopyable.h Examining data/gsmartcontrol-1.1.3/src/hz/tls_policy_pthread.h Examining data/gsmartcontrol-1.1.3/src/hz/fs_dir_test.cpp Examining data/gsmartcontrol-1.1.3/src/hz/sync_test.cpp Examining data/gsmartcontrol-1.1.3/src/hz/locale_tools.h Examining data/gsmartcontrol-1.1.3/src/hz/scoped_ptr.h Examining data/gsmartcontrol-1.1.3/src/hz/instance_manager.h Examining data/gsmartcontrol-1.1.3/src/hz/stream_cast.h Examining data/gsmartcontrol-1.1.3/src/hz/down_cast.h Examining data/gsmartcontrol-1.1.3/src/hz/hz_config.h Examining data/gsmartcontrol-1.1.3/src/hz/sync_policy_glibmm.h Examining data/gsmartcontrol-1.1.3/src/hz/local_algo.h Examining data/gsmartcontrol-1.1.3/src/hz/intrusive_scoped_lock.h Examining data/gsmartcontrol-1.1.3/src/hz/bin2ascii_encoder_test.cpp Examining data/gsmartcontrol-1.1.3/src/hz/optional_value.h Examining data/gsmartcontrol-1.1.3/src/hz/debug.h Examining data/gsmartcontrol-1.1.3/src/hz/sync_policy_poco.h Examining data/gsmartcontrol-1.1.3/src/hz/fs_tools.h Examining data/gsmartcontrol-1.1.3/src/hz/sync_policy_win32.h Examining data/gsmartcontrol-1.1.3/src/hz/process_signal.h Examining data/gsmartcontrol-1.1.3/src/hz/string_num_test.cpp Examining data/gsmartcontrol-1.1.3/src/hz/any_type_test.cpp Examining data/gsmartcontrol-1.1.3/src/hz/string_sprintf_macros.h Examining data/gsmartcontrol-1.1.3/src/hz/fs_path.h Examining data/gsmartcontrol-1.1.3/src/hz/portable_snprintf.h Examining data/gsmartcontrol-1.1.3/src/hz/res_data.h Examining data/gsmartcontrol-1.1.3/src/hz/down_cast_test.cpp Examining data/gsmartcontrol-1.1.3/src/hz/bin2ascii_encoder.h Examining data/gsmartcontrol-1.1.3/src/hz/sync_multilock.h Examining data/gsmartcontrol-1.1.3/src/hz/fs_path_utils.h Examining data/gsmartcontrol-1.1.3/src/gsc_init.h Examining data/gsmartcontrol-1.1.3/src/gsc_executor_error_dialog.h Examining data/gsmartcontrol-1.1.3/src/gsc_executor_log_window.h Examining data/gsmartcontrol-1.1.3/src/gsc_info_window.h Examining data/gsmartcontrol-1.1.3/src/gsc_preferences_window.cpp Examining data/gsmartcontrol-1.1.3/src/gsc_init.cpp Examining data/gsmartcontrol-1.1.3/src/gsc_add_device_window.h Examining data/gsmartcontrol-1.1.3/src/gsc_add_device_window.cpp Examining data/gsmartcontrol-1.1.3/src/applib/executor_factory.h Examining data/gsmartcontrol-1.1.3/src/applib/selftest.cpp Examining data/gsmartcontrol-1.1.3/src/applib/storage_detector_other.cpp Examining data/gsmartcontrol-1.1.3/src/applib/app_gtkmm_features.h Examining data/gsmartcontrol-1.1.3/src/applib/app_ui_res_utils_test_data.cpp Examining data/gsmartcontrol-1.1.3/src/applib/app_ui_res_utils.h Examining data/gsmartcontrol-1.1.3/src/applib/storage_detector_linux.cpp Examining data/gsmartcontrol-1.1.3/src/applib/storage_detector_helpers.h Examining data/gsmartcontrol-1.1.3/src/applib/app_gtkmm_utils.cpp Examining data/gsmartcontrol-1.1.3/src/applib/storage_property_colors.h Examining data/gsmartcontrol-1.1.3/src/applib/cli_executors.h Examining data/gsmartcontrol-1.1.3/src/applib/gui_utils.h Examining data/gsmartcontrol-1.1.3/src/applib/storage_detector_win32.cpp Examining data/gsmartcontrol-1.1.3/src/applib/cmdex.h Examining data/gsmartcontrol-1.1.3/src/applib/selftest.h Examining data/gsmartcontrol-1.1.3/src/applib/app_pango_utils.cpp Examining data/gsmartcontrol-1.1.3/src/applib/storage_property_descr.h Examining data/gsmartcontrol-1.1.3/src/applib/storage_detector_win32.h Examining data/gsmartcontrol-1.1.3/src/applib/app_gtkmm_utils.h Examining data/gsmartcontrol-1.1.3/src/applib/storage_detector_linux.h Examining data/gsmartcontrol-1.1.3/src/applib/spawn_test.cpp Examining data/gsmartcontrol-1.1.3/src/applib/smartctl_executor_test.cpp Examining data/gsmartcontrol-1.1.3/src/applib/cmdex_sync.cpp Examining data/gsmartcontrol-1.1.3/src/applib/storage_device.h Examining data/gsmartcontrol-1.1.3/src/applib/smartctl_parser_test.cpp Examining data/gsmartcontrol-1.1.3/src/applib/cmdex.cpp Examining data/gsmartcontrol-1.1.3/src/applib/executor_factory.cpp Examining data/gsmartcontrol-1.1.3/src/applib/storage_detector_other.h Examining data/gsmartcontrol-1.1.3/src/applib/smartctl_executor.h Examining data/gsmartcontrol-1.1.3/src/applib/gui_utils.cpp Examining data/gsmartcontrol-1.1.3/src/applib/cmdex_sync_gui.cpp Examining data/gsmartcontrol-1.1.3/src/applib/app_pango_utils.h Examining data/gsmartcontrol-1.1.3/src/applib/smartctl_parser.h Examining data/gsmartcontrol-1.1.3/src/applib/storage_device.cpp Examining data/gsmartcontrol-1.1.3/src/applib/storage_property.cpp Examining data/gsmartcontrol-1.1.3/src/applib/app_ui_res_utils_test.cpp Examining data/gsmartcontrol-1.1.3/src/applib/smartctl_executor_gui.h Examining data/gsmartcontrol-1.1.3/src/applib/storage_detector.cpp Examining data/gsmartcontrol-1.1.3/src/applib/storage_detector_test.cpp Examining data/gsmartcontrol-1.1.3/src/applib/storage_detector.h Examining data/gsmartcontrol-1.1.3/src/applib/cmdex_sync_gui.h Examining data/gsmartcontrol-1.1.3/src/applib/storage_settings.h Examining data/gsmartcontrol-1.1.3/src/applib/app_pcrecpp.h Examining data/gsmartcontrol-1.1.3/src/applib/cmdex_sync.h Examining data/gsmartcontrol-1.1.3/src/applib/smartctl_executor.cpp Examining data/gsmartcontrol-1.1.3/src/applib/storage_property.h Examining data/gsmartcontrol-1.1.3/src/applib/smartctl_parser.cpp Examining data/gsmartcontrol-1.1.3/src/applib/storage_property_descr.cpp Examining data/gsmartcontrol-1.1.3/src/gsc_settings.h Examining data/gsmartcontrol-1.1.3/src/gsc_info_window.cpp Examining data/gsmartcontrol-1.1.3/src/gsc_about_dialog.h Examining data/gsmartcontrol-1.1.3/src/gsc_main_window_iconview.h Examining data/gsmartcontrol-1.1.3/src/global_macros.h Examining data/gsmartcontrol-1.1.3/src/gsc_executor_error_dialog.cpp Examining data/gsmartcontrol-1.1.3/src/gsc_main_window.h Examining data/gsmartcontrol-1.1.3/src/res/gsc_main_window.ui.cpp Examining data/gsmartcontrol-1.1.3/src/res/gsc_executor_log_window.ui.cpp Examining data/gsmartcontrol-1.1.3/src/res/gsc_add_device_window.ui.cpp Examining data/gsmartcontrol-1.1.3/src/res/gsc_text_window.ui.cpp Examining data/gsmartcontrol-1.1.3/src/res/gsc_about_dialog.ui.cpp Examining data/gsmartcontrol-1.1.3/src/res/gsc_info_window.ui.cpp Examining data/gsmartcontrol-1.1.3/src/res/gsc_preferences_window.ui.cpp Examining data/gsmartcontrol-1.1.3/src/res/AUTHORS.txt.cpp Examining data/gsmartcontrol-1.1.3/src/res/LICENSE_gsmartcontrol.txt.cpp Examining data/gsmartcontrol-1.1.3/src/libdebug/dstate_pub.h Examining data/gsmartcontrol-1.1.3/src/libdebug/dout.cpp Examining data/gsmartcontrol-1.1.3/src/libdebug/dchannel.cpp Examining data/gsmartcontrol-1.1.3/src/libdebug/dflags.cpp Examining data/gsmartcontrol-1.1.3/src/libdebug/dstate.h Examining data/gsmartcontrol-1.1.3/src/libdebug/dcmdarg.h Examining data/gsmartcontrol-1.1.3/src/libdebug/dout.h Examining data/gsmartcontrol-1.1.3/src/libdebug/dchannel.h Examining data/gsmartcontrol-1.1.3/src/libdebug/libdebug_test.cpp Examining data/gsmartcontrol-1.1.3/src/libdebug/dstream.cpp Examining data/gsmartcontrol-1.1.3/src/libdebug/libdebug_mini.h Examining data/gsmartcontrol-1.1.3/src/libdebug/dexcept.h Examining data/gsmartcontrol-1.1.3/src/libdebug/dflags.h Examining data/gsmartcontrol-1.1.3/src/libdebug/dstate.cpp Examining data/gsmartcontrol-1.1.3/src/libdebug/libdebug.h Examining data/gsmartcontrol-1.1.3/src/libdebug/dcmdarg.cpp Examining data/gsmartcontrol-1.1.3/src/libdebug/dstream.h Examining data/gsmartcontrol-1.1.3/src/gsc_text_window.h Examining data/gsmartcontrol-1.1.3/src/gsc_main_window.cpp Examining data/gsmartcontrol-1.1.3/src/rconfig/rcdump.h Examining data/gsmartcontrol-1.1.3/src/rconfig/rcloadsave.h Examining data/gsmartcontrol-1.1.3/src/rconfig/rcautosave.h Examining data/gsmartcontrol-1.1.3/src/rconfig/rconfig_mini.h Examining data/gsmartcontrol-1.1.3/src/rconfig/rconfig_test.cpp Examining data/gsmartcontrol-1.1.3/src/rconfig/rconfig.h Examining data/gsmartcontrol-1.1.3/src/rconfig/rcmain.h Examining data/gsmartcontrol-1.1.3/src/gsc_main.cpp Examining data/gsmartcontrol-1.1.3/src/gsc_about_dialog.cpp FINAL RESULTS: data/gsmartcontrol-1.1.3/src/hz/fs_file.h:808:3: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod(to.c_str(), st.st_mode & 07777); // don't transfer unneeded stuff (like "is directory"). data/gsmartcontrol-1.1.3/src/hz/fs_path.h:777:21: [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. ssize_t written = readlink(this->c_str(), buf, buf_size); data/gsmartcontrol-1.1.3/src/hz/debug.h:163:10: [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. std::fprintf(stderr, (std::string("<dump> [") + (domain) + "] " + format).c_str(), ## __VA_ARGS__) data/gsmartcontrol-1.1.3/src/hz/debug.h:166:10: [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. std::fprintf(stderr, (std::string("<info> [") + (domain) + "] " + format).c_str(), ## __VA_ARGS__) data/gsmartcontrol-1.1.3/src/hz/debug.h:169:10: [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. std::fprintf(stderr, (std::string("<warn> [") + (domain) + "] " + format).c_str(), ## __VA_ARGS__) data/gsmartcontrol-1.1.3/src/hz/debug.h:172:10: [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. std::fprintf(stderr, (std::string("<error> [") + (domain) + "] " + format).c_str(), ## __VA_ARGS__) data/gsmartcontrol-1.1.3/src/hz/debug.h:175:10: [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. std::fprintf(stderr, (std::string("<fatal> [") + (domain) + "] " + format).c_str(), ## __VA_ARGS__) data/gsmartcontrol-1.1.3/src/hz/debug.h:187:12: [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. std::vfprintf(stderr, (header + format).c_str(), ap); data/gsmartcontrol-1.1.3/src/hz/fs_path.h:496:6: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access(this->c_str(), R_OK) == -1) // from unistd.h data/gsmartcontrol-1.1.3/src/hz/fs_path.h:566:7: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access(dirname.c_str(), W_OK) == -1) { data/gsmartcontrol-1.1.3/src/hz/fs_path.h:572:8: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access(this->c_str(), W_OK) == -1) data/gsmartcontrol-1.1.3/src/hz/fs_path.h:576:8: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access(dirname.c_str(), W_OK) == -1) data/gsmartcontrol-1.1.3/src/hz/fs_path.h:602:6: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access(this->c_str(), F_OK) == -1) data/gsmartcontrol-1.1.3/src/hz/portable_snprintf.h:69:9: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. (void)snprintf((buf), (buf_size), __VA_ARGS__) data/gsmartcontrol-1.1.3/src/hz/portable_snprintf.h:102:11: [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. (void)((_snprintf((buf), (buf_size) - 1, __VA_ARGS__) == ((buf_size) - 1)) && ((buf)[(buf_size)-1] = '\0')) data/gsmartcontrol-1.1.3/src/hz/portable_snprintf.h:108:30: [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. #error Cannot find suitable snprintf() implementation for portable_snprintf() data/gsmartcontrol-1.1.3/src/hz/portable_snprintf.h:138:9: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. (void)vsnprintf((buf), (buf_size), (format), (ap)) data/gsmartcontrol-1.1.3/src/hz/portable_snprintf.h:180:30: [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. #error Cannot find suitable vsnprintf() implementation for portable_vsnprintf() data/gsmartcontrol-1.1.3/src/hz/string_sprintf.h:113:19: [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. const int size = vsnprintf(&c, 1, format, ap); // C99 and others data/gsmartcontrol-1.1.3/src/hz/string_sprintf.h:137:21: [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. const int size = vsnprintf(buf, buf_size, format, ap); // assume same as above data/gsmartcontrol-1.1.3/src/hz/string_sprintf.h:207:13: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. written = vsnprintf(buf, size, format, ap); // writes size chars, including 0. data/gsmartcontrol-1.1.3/src/hz/string_sprintf.h:216:13: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. written = vsnprintf(buf, size, format, ap); // writes size chars, including 0. data/gsmartcontrol-1.1.3/src/hz/string_sprintf_macros.h:55:25: [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. #warning Cannot detect vsnprintf() availability data/gsmartcontrol-1.1.3/src/hz/sync_policy_win32.h:13:58: [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. #error Cannot compile a win32-only file under non-win32 system data/gsmartcontrol-1.1.3/src/hz/system_specific.h:63:77: [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 HZ_FUNC_PRINTF_ISO_CHECK(format_idx, check_idx) HZ_GCC_ATTR(format(printf, format_idx, check_idx)) data/gsmartcontrol-1.1.3/src/hz/tls_policy_win32.h:18:58: [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. #error Cannot compile a win32-only file under non-win32 system data/gsmartcontrol-1.1.3/src/hz/env_tools.h:112: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* v = std::getenv(name.c_str()); data/gsmartcontrol-1.1.3/src/hz/sync_policy_win32.h:48:5: [3] (misc) EnterCriticalSection: On some versions of Windows, exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. EnterCriticalSection(&mutex); data/gsmartcontrol-1.1.3/src/applib/storage_detector_linux.cpp:149:12: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if (!file.open("rb")) // closed automatically data/gsmartcontrol-1.1.3/src/applib/storage_detector_linux.cpp:156: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 line[256]; data/gsmartcontrol-1.1.3/src/applib/storage_detector_other.cpp:247:33: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if (open_needed && !dev_file.open("rb") && dev_file.get_errno() == ENXIO) { data/gsmartcontrol-1.1.3/src/applib/storage_detector_win32.cpp:147: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 volume_name_w[MAX_PATH+1] = {0}; data/gsmartcontrol-1.1.3/src/hz/ascii.h:427:8: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(copy, wnptr, radix_pos - wnptr); // copy up until '.'. data/gsmartcontrol-1.1.3/src/hz/ascii.h:429:8: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(cpos, radix, radix_len); // copy the locale radix data/gsmartcontrol-1.1.3/src/hz/ascii.h:431:8: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(cpos, radix_pos + 1, end_pos - radix_pos - 1); data/gsmartcontrol-1.1.3/src/hz/ascii.h:461:8: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(copy, wnptr, end_pos - wnptr); data/gsmartcontrol-1.1.3/src/hz/env_tools.h:57: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 dummy[2]; data/gsmartcontrol-1.1.3/src/hz/env_tools.h:172:7: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(buf, putenv_arg.c_str(), putenv_arg.size() + 1); data/gsmartcontrol-1.1.3/src/hz/env_tools.h:206:7: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(buf, putenv_arg.c_str(), putenv_arg.size() + 1); data/gsmartcontrol-1.1.3/src/hz/errno_string.h:87: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[buf_size] = {0}; data/gsmartcontrol-1.1.3/src/hz/errno_string.h:112: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 msg_buf[128] = {0}; // MS docs don't say exactly, but it's somewhere in 80-100 range. data/gsmartcontrol-1.1.3/src/hz/fs_dir.h:481:15: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). inline bool open(); data/gsmartcontrol-1.1.3/src/hz/fs_dir.h:484:15: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). inline bool open(const std::string& path); data/gsmartcontrol-1.1.3/src/hz/fs_dir.h:672: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). inline bool Dir::open() data/gsmartcontrol-1.1.3/src/hz/fs_dir.h:700: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). inline bool Dir::open(const std::string& path) data/gsmartcontrol-1.1.3/src/hz/fs_dir.h:703:9: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). return open(); data/gsmartcontrol-1.1.3/src/hz/fs_dir.h:739: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). if (!open()) data/gsmartcontrol-1.1.3/src/hz/fs_dir.h:769: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). if (!open()) data/gsmartcontrol-1.1.3/src/hz/fs_dir.h:825: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). if (!open()) // this sets the error if needed data/gsmartcontrol-1.1.3/src/hz/fs_dir_platform.h:118: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 full_pattern[MAX_PATH + 3]; // directory search pattern + "\\*" data/gsmartcontrol-1.1.3/src/hz/fs_dir_test.cpp:109:12: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if (!dir.open()) { data/gsmartcontrol-1.1.3/src/hz/fs_file.h:187:10: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). this->open(open_mode); data/gsmartcontrol-1.1.3/src/hz/fs_file.h:195:10: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). this->open(open_mode); data/gsmartcontrol-1.1.3/src/hz/fs_file.h:238:15: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). inline bool open(const std::string& open_mode); data/gsmartcontrol-1.1.3/src/hz/fs_file.h:358:19: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). inline bool File::open(const std::string& open_mode) data/gsmartcontrol-1.1.3/src/hz/fs_file.h:619:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[buf_size] = {0}; data/gsmartcontrol-1.1.3/src/hz/fs_file.h:745:11: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char buf[buf_size] = {0}; data/gsmartcontrol-1.1.3/src/hz/fs_file.h:829:14: [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 std::fopen(file, open_mode); data/gsmartcontrol-1.1.3/src/hz/i18n.h:61: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. std::memcpy(msg_with_context, context, context_len - 1); data/gsmartcontrol-1.1.3/src/hz/i18n.h:63: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. std::memcpy(msg_with_context + context_len, clean_msg, clean_msg_len); data/gsmartcontrol-1.1.3/src/hz/process_signal.h:131: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[64] = {0}; data/gsmartcontrol-1.1.3/src/hz/process_signal.h:141: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[64] = {0}; data/gsmartcontrol-1.1.3/src/hz/win32_tools.h:202: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[MAX_PATH] = {0}; data/gsmartcontrol-1.1.3/src/hz/win32_tools.h:247: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[MAX_PATH] = {0}; data/gsmartcontrol-1.1.3/src/hz/win32_tools.h:437: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 name[MAX_PATH] = {0}; data/gsmartcontrol-1.1.3/src/hz/win32_tools.h:593:21: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). int wide_bufsize = MultiByteToWideChar(from_cp, 0, from_str, -1, 0, 0); // including terminating 0 data/gsmartcontrol-1.1.3/src/hz/win32_tools.h:602:18: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). int conv_size = MultiByteToWideChar(from_cp, 0, from_str, -1, res, wide_bufsize); data/gsmartcontrol-1.1.3/src/applib/app_gtkmm_utils.cpp:81:31: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). remaining_bytes = gint(std::strlen(name)); data/gsmartcontrol-1.1.3/src/gsc_executor_log_window.cpp:261:50: [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 (file.rfind(".txt") != (file.size() - std::strlen(".txt"))) { data/gsmartcontrol-1.1.3/src/gsc_executor_log_window.cpp:378:50: [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 (file.rfind(".txt") != (file.size() - std::strlen(".txt"))) { data/gsmartcontrol-1.1.3/src/gsc_info_window.cpp:1860:50: [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 (file.rfind(".txt") != (file.size() - std::strlen(".txt"))) { data/gsmartcontrol-1.1.3/src/gsc_text_window.h:212:52: [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 (file.rfind(".txt") != (file.size() - std::strlen(".txt"))) { data/gsmartcontrol-1.1.3/src/hz/ascii.h:391:40: [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::size_t radix_len = (radix ? std::strlen(radix) : 0U); data/gsmartcontrol-1.1.3/src/hz/ascii.h:406:31: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). std::size_t wnptr_len = std::strlen(wnptr); data/gsmartcontrol-1.1.3/src/hz/fs_dir_platform.h:168: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). std::size_t len = wcslen(dir->full_pattern); data/gsmartcontrol-1.1.3/src/hz/fs_path_utils.h:142:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). std::strncpy(buf, path.c_str(), buf_size); data/gsmartcontrol-1.1.3/src/hz/fs_path_utils.h:186:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). std::strncpy(buf, path.c_str(), buf_size); data/gsmartcontrol-1.1.3/src/hz/i18n.h:56: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). std::size_t context_len = std::strlen(context) + 1; data/gsmartcontrol-1.1.3/src/hz/i18n.h:57: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). std::size_t clean_msg_len = std::strlen(clean_msg) + 1; data/gsmartcontrol-1.1.3/src/hz/intrusive_ptr.h:88:30: [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::size_t buf_len = std::strlen(msg) + 1; data/gsmartcontrol-1.1.3/src/hz/intrusive_ptr.h:89:15: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). msg_ = std::strncpy(new char[buf_len], msg, buf_len); data/gsmartcontrol-1.1.3/src/hz/intrusive_ptr.h:99:30: [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::size_t msg_len = std::strlen(msg); data/gsmartcontrol-1.1.3/src/hz/intrusive_ptr.h:100:31: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). std::size_t tmsg_len = std::strlen(tmsg); data/gsmartcontrol-1.1.3/src/hz/intrusive_ptr.h:101: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). std::size_t tname_len = std::strlen(tname); data/gsmartcontrol-1.1.3/src/hz/intrusive_ptr.h:103:8: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). std::strncpy(msg_, msg, msg_len); data/gsmartcontrol-1.1.3/src/hz/intrusive_ptr.h:104:8: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). std::strncpy(msg_ + msg_len, tmsg, tmsg_len); data/gsmartcontrol-1.1.3/src/hz/intrusive_ptr.h:105:8: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). std::strncpy(msg_ + msg_len + tmsg_len, tname, tname_len + 1); data/gsmartcontrol-1.1.3/src/hz/win32_tools.h:479:24: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). bool empty = (std::fgetc(file) == EOF); data/gsmartcontrol-1.1.3/src/hz/win32_tools.h:497:24: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). bool empty = (std::fgetc(file) == EOF); data/gsmartcontrol-1.1.3/src/libdebug/dexcept.h:27:30: [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::size_t buf_len = std::strlen(msg) + 1; data/gsmartcontrol-1.1.3/src/libdebug/dexcept.h:28:15: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). msg_ = std::strncpy(new char[buf_len], msg, buf_len); data/gsmartcontrol-1.1.3/src/libdebug/dexcept.h:57:30: [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::size_t buf_len = std::strlen(msg) + 1; data/gsmartcontrol-1.1.3/src/libdebug/dexcept.h:58:15: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). msg_ = std::strncpy(new char[buf_len], msg, buf_len); data/gsmartcontrol-1.1.3/src/rmn/resource_serialization.h:303: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). if (from_path && !path.compare(0, strlen(from_path), from_path)) { data/gsmartcontrol-1.1.3/src/rmn/resource_serialization.h:304:23: [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 (path.size() > (strlen(from_path) + 1)) { // leading path + separator data/gsmartcontrol-1.1.3/src/rmn/resource_serialization.h:305: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). path.erase(0, strlen(from_path) + 1); ANALYSIS SUMMARY: Hits = 96 Lines analyzed = 208704 in approximately 2.64 seconds (79001 lines/second) Physical Source Lines of Code (SLOC) = 185452 Hits@level = [0] 8 [1] 29 [2] 39 [3] 2 [4] 24 [5] 2 Hits@level+ = [0+] 104 [1+] 96 [2+] 67 [3+] 28 [4+] 26 [5+] 2 Hits/KSLOC@level+ = [0+] 0.560792 [1+] 0.517654 [2+] 0.361279 [3+] 0.150982 [4+] 0.140198 [5+] 0.0107845 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.