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/snapper-0.8.14/client/Command.cc Examining data/snapper-0.8.14/client/Command.h Examining data/snapper-0.8.14/client/Command/ColumnsOption.cc Examining data/snapper-0.8.14/client/Command/ColumnsOption.h Examining data/snapper-0.8.14/client/Command/GetConfig.cc Examining data/snapper-0.8.14/client/Command/GetConfig.h Examining data/snapper-0.8.14/client/Command/GetConfig/ConfigData.cc Examining data/snapper-0.8.14/client/Command/GetConfig/ConfigData.h Examining data/snapper-0.8.14/client/Command/GetConfig/ConfigData/Csv.cc Examining data/snapper-0.8.14/client/Command/GetConfig/ConfigData/Csv.h Examining data/snapper-0.8.14/client/Command/GetConfig/ConfigData/Json.cc Examining data/snapper-0.8.14/client/Command/GetConfig/ConfigData/Json.h Examining data/snapper-0.8.14/client/Command/GetConfig/ConfigData/Table.cc Examining data/snapper-0.8.14/client/Command/GetConfig/ConfigData/Table.h Examining data/snapper-0.8.14/client/Command/GetConfig/Options.cc Examining data/snapper-0.8.14/client/Command/GetConfig/Options.h Examining data/snapper-0.8.14/client/Command/ListConfigs.cc Examining data/snapper-0.8.14/client/Command/ListConfigs.h Examining data/snapper-0.8.14/client/Command/ListConfigs/Options.cc Examining data/snapper-0.8.14/client/Command/ListConfigs/Options.h Examining data/snapper-0.8.14/client/Command/ListConfigs/SnappersData.cc Examining data/snapper-0.8.14/client/Command/ListConfigs/SnappersData.h Examining data/snapper-0.8.14/client/Command/ListConfigs/SnappersData/Csv.cc Examining data/snapper-0.8.14/client/Command/ListConfigs/SnappersData/Csv.h Examining data/snapper-0.8.14/client/Command/ListConfigs/SnappersData/Json.cc Examining data/snapper-0.8.14/client/Command/ListConfigs/SnappersData/Json.h Examining data/snapper-0.8.14/client/Command/ListConfigs/SnappersData/Table.cc Examining data/snapper-0.8.14/client/Command/ListConfigs/SnappersData/Table.h Examining data/snapper-0.8.14/client/Command/ListSnapshots.cc Examining data/snapper-0.8.14/client/Command/ListSnapshots.h Examining data/snapper-0.8.14/client/Command/ListSnapshots/Options.cc Examining data/snapper-0.8.14/client/Command/ListSnapshots/Options.h Examining data/snapper-0.8.14/client/Command/ListSnapshots/SnappersData.cc Examining data/snapper-0.8.14/client/Command/ListSnapshots/SnappersData.h Examining data/snapper-0.8.14/client/Command/ListSnapshots/SnappersData/Csv.cc Examining data/snapper-0.8.14/client/Command/ListSnapshots/SnappersData/Csv.h Examining data/snapper-0.8.14/client/Command/ListSnapshots/SnappersData/Json.cc Examining data/snapper-0.8.14/client/Command/ListSnapshots/SnappersData/Json.h Examining data/snapper-0.8.14/client/Command/ListSnapshots/SnappersData/Table.cc Examining data/snapper-0.8.14/client/Command/ListSnapshots/SnappersData/Table.h Examining data/snapper-0.8.14/client/GlobalOptions.cc Examining data/snapper-0.8.14/client/GlobalOptions.h Examining data/snapper-0.8.14/client/MyFiles.cc Examining data/snapper-0.8.14/client/MyFiles.h Examining data/snapper-0.8.14/client/Options.cc Examining data/snapper-0.8.14/client/Options.h Examining data/snapper-0.8.14/client/cleanup.cc Examining data/snapper-0.8.14/client/cleanup.h Examining data/snapper-0.8.14/client/cmd-cleanup.cc Examining data/snapper-0.8.14/client/cmd-create-config.cc Examining data/snapper-0.8.14/client/cmd-create.cc Examining data/snapper-0.8.14/client/cmd-debug.cc Examining data/snapper-0.8.14/client/cmd-delete-config.cc Examining data/snapper-0.8.14/client/cmd-delete.cc Examining data/snapper-0.8.14/client/cmd-diff.cc Examining data/snapper-0.8.14/client/cmd-get-config.cc Examining data/snapper-0.8.14/client/cmd-list-configs.cc Examining data/snapper-0.8.14/client/cmd-list.cc Examining data/snapper-0.8.14/client/cmd-modify.cc Examining data/snapper-0.8.14/client/cmd-mount.cc Examining data/snapper-0.8.14/client/cmd-rollback.cc Examining data/snapper-0.8.14/client/cmd-set-config.cc Examining data/snapper-0.8.14/client/cmd-setup-quota.cc Examining data/snapper-0.8.14/client/cmd-status.cc Examining data/snapper-0.8.14/client/cmd-umount.cc Examining data/snapper-0.8.14/client/cmd-undochange.cc Examining data/snapper-0.8.14/client/cmd-xadiff.cc Examining data/snapper-0.8.14/client/cmd.h Examining data/snapper-0.8.14/client/commands.cc Examining data/snapper-0.8.14/client/commands.h Examining data/snapper-0.8.14/client/errors.cc Examining data/snapper-0.8.14/client/errors.h Examining data/snapper-0.8.14/client/installation-helper.cc Examining data/snapper-0.8.14/client/misc.cc Examining data/snapper-0.8.14/client/misc.h Examining data/snapper-0.8.14/client/mksubvolume.cc Examining data/snapper-0.8.14/client/proxy-dbus.cc Examining data/snapper-0.8.14/client/proxy-dbus.h Examining data/snapper-0.8.14/client/proxy-lib.cc Examining data/snapper-0.8.14/client/proxy-lib.h Examining data/snapper-0.8.14/client/proxy.cc Examining data/snapper-0.8.14/client/proxy.h Examining data/snapper-0.8.14/client/snapper.cc Examining data/snapper-0.8.14/client/systemd-helper.cc Examining data/snapper-0.8.14/client/types.cc Examining data/snapper-0.8.14/client/types.h Examining data/snapper-0.8.14/client/utils/CsvFormatter.cc Examining data/snapper-0.8.14/client/utils/CsvFormatter.h Examining data/snapper-0.8.14/client/utils/GetOpts.cc Examining data/snapper-0.8.14/client/utils/GetOpts.h Examining data/snapper-0.8.14/client/utils/HumanString.cc Examining data/snapper-0.8.14/client/utils/HumanString.h Examining data/snapper-0.8.14/client/utils/JsonFormatter.cc Examining data/snapper-0.8.14/client/utils/JsonFormatter.h Examining data/snapper-0.8.14/client/utils/Range.cc Examining data/snapper-0.8.14/client/utils/Range.h Examining data/snapper-0.8.14/client/utils/Table.cc Examining data/snapper-0.8.14/client/utils/Table.h Examining data/snapper-0.8.14/client/utils/TableFormatter.cc Examining data/snapper-0.8.14/client/utils/TableFormatter.h Examining data/snapper-0.8.14/client/utils/console.cc Examining data/snapper-0.8.14/client/utils/console.h Examining data/snapper-0.8.14/client/utils/equal-date.cc Examining data/snapper-0.8.14/client/utils/equal-date.h Examining data/snapper-0.8.14/client/utils/text.cc Examining data/snapper-0.8.14/client/utils/text.h Examining data/snapper-0.8.14/dbus/DBusConnection.cc Examining data/snapper-0.8.14/dbus/DBusConnection.h Examining data/snapper-0.8.14/dbus/DBusMainLoop.cc Examining data/snapper-0.8.14/dbus/DBusMainLoop.h Examining data/snapper-0.8.14/dbus/DBusMessage.cc Examining data/snapper-0.8.14/dbus/DBusMessage.h Examining data/snapper-0.8.14/examples/c++-lib/CmpDirs.cc Examining data/snapper-0.8.14/examples/c++-lib/Create.cc Examining data/snapper-0.8.14/examples/c++-lib/CreateNumber.cc Examining data/snapper-0.8.14/examples/c++-lib/CreateTimeline.cc Examining data/snapper-0.8.14/examples/c++-lib/List.cc Examining data/snapper-0.8.14/examples/c++-lib/ListAll.cc Examining data/snapper-0.8.14/examples/c/snapper_dbus_cli.c Examining data/snapper-0.8.14/examples/qt/client-qt.cc Examining data/snapper-0.8.14/pam/pam_snapper.c Examining data/snapper-0.8.14/server/Background.cc Examining data/snapper-0.8.14/server/Background.h Examining data/snapper-0.8.14/server/Client.cc Examining data/snapper-0.8.14/server/Client.h Examining data/snapper-0.8.14/server/MetaSnapper.cc Examining data/snapper-0.8.14/server/MetaSnapper.h Examining data/snapper-0.8.14/server/Types.cc Examining data/snapper-0.8.14/server/Types.h Examining data/snapper-0.8.14/server/snapperd.cc Examining data/snapper-0.8.14/snapper/Acls.cc Examining data/snapper-0.8.14/snapper/Acls.h Examining data/snapper-0.8.14/snapper/AppUtil.cc Examining data/snapper-0.8.14/snapper/AppUtil.h Examining data/snapper-0.8.14/snapper/AsciiFile.cc Examining data/snapper-0.8.14/snapper/AsciiFile.h Examining data/snapper-0.8.14/snapper/Btrfs.cc Examining data/snapper-0.8.14/snapper/Btrfs.h Examining data/snapper-0.8.14/snapper/BtrfsUtils.cc Examining data/snapper-0.8.14/snapper/BtrfsUtils.h Examining data/snapper-0.8.14/snapper/Compare.cc Examining data/snapper-0.8.14/snapper/Compare.h Examining data/snapper-0.8.14/snapper/Comparison.cc Examining data/snapper-0.8.14/snapper/Comparison.h Examining data/snapper-0.8.14/snapper/Enum.cc Examining data/snapper-0.8.14/snapper/Enum.h Examining data/snapper-0.8.14/snapper/Exception.cc Examining data/snapper-0.8.14/snapper/Exception.h Examining data/snapper-0.8.14/snapper/Ext4.cc Examining data/snapper-0.8.14/snapper/Ext4.h Examining data/snapper-0.8.14/snapper/File.cc Examining data/snapper-0.8.14/snapper/File.h Examining data/snapper-0.8.14/snapper/FileUtils.cc Examining data/snapper-0.8.14/snapper/FileUtils.h Examining data/snapper-0.8.14/snapper/Filesystem.cc Examining data/snapper-0.8.14/snapper/Filesystem.h Examining data/snapper-0.8.14/snapper/Hooks.cc Examining data/snapper-0.8.14/snapper/Hooks.h Examining data/snapper-0.8.14/snapper/Log.cc Examining data/snapper-0.8.14/snapper/Log.h Examining data/snapper-0.8.14/snapper/Logger.cc Examining data/snapper-0.8.14/snapper/Logger.h Examining data/snapper-0.8.14/snapper/Lvm.cc Examining data/snapper-0.8.14/snapper/Lvm.h Examining data/snapper-0.8.14/snapper/LvmCache.cc Examining data/snapper-0.8.14/snapper/LvmCache.h Examining data/snapper-0.8.14/snapper/LvmUtils.cc Examining data/snapper-0.8.14/snapper/LvmUtils.h Examining data/snapper-0.8.14/snapper/MntTable.cc Examining data/snapper-0.8.14/snapper/MntTable.h Examining data/snapper-0.8.14/snapper/Regex.cc Examining data/snapper-0.8.14/snapper/Regex.h Examining data/snapper-0.8.14/snapper/Selinux.cc Examining data/snapper-0.8.14/snapper/Selinux.h Examining data/snapper-0.8.14/snapper/Snapper.cc Examining data/snapper-0.8.14/snapper/Snapper.h Examining data/snapper-0.8.14/snapper/SnapperDefines.h Examining data/snapper-0.8.14/snapper/SnapperTmpl.h Examining data/snapper-0.8.14/snapper/SnapperTypes.h Examining data/snapper-0.8.14/snapper/Snapshot.cc Examining data/snapper-0.8.14/snapper/Snapshot.h Examining data/snapper-0.8.14/snapper/SystemCmd.cc Examining data/snapper-0.8.14/snapper/SystemCmd.h Examining data/snapper-0.8.14/snapper/XAttributes.cc Examining data/snapper-0.8.14/snapper/XAttributes.h Examining data/snapper-0.8.14/snapper/XmlFile.cc Examining data/snapper-0.8.14/snapper/XmlFile.h Examining data/snapper-0.8.14/testsuite-cmp/cmp.cc Examining data/snapper-0.8.14/testsuite-real/common.cc Examining data/snapper-0.8.14/testsuite-real/common.h Examining data/snapper-0.8.14/testsuite-real/directory1.cc Examining data/snapper-0.8.14/testsuite-real/error1.cc Examining data/snapper-0.8.14/testsuite-real/error2.cc Examining data/snapper-0.8.14/testsuite-real/error4.cc Examining data/snapper-0.8.14/testsuite-real/missing-directory1.cc Examining data/snapper-0.8.14/testsuite-real/owner1.cc Examining data/snapper-0.8.14/testsuite-real/owner2.cc Examining data/snapper-0.8.14/testsuite-real/owner3.cc Examining data/snapper-0.8.14/testsuite-real/permissions1.cc Examining data/snapper-0.8.14/testsuite-real/permissions2.cc Examining data/snapper-0.8.14/testsuite-real/permissions3.cc Examining data/snapper-0.8.14/testsuite-real/simple1.cc Examining data/snapper-0.8.14/testsuite-real/test-btrfsutils.cc Examining data/snapper-0.8.14/testsuite-real/ug-tests.cc Examining data/snapper-0.8.14/testsuite-real/xattrs1.cc Examining data/snapper-0.8.14/testsuite-real/xattrs2.cc Examining data/snapper-0.8.14/testsuite-real/xattrs3.cc Examining data/snapper-0.8.14/testsuite-real/xattrs4.cc Examining data/snapper-0.8.14/testsuite-real/xattrs_utils.cc Examining data/snapper-0.8.14/testsuite-real/xattrs_utils.h Examining data/snapper-0.8.14/testsuite/basename1.cc Examining data/snapper-0.8.14/testsuite/cmp-lt.cc Examining data/snapper-0.8.14/testsuite/csv-formatter.cc Examining data/snapper-0.8.14/testsuite/dbus-escape.cc Examining data/snapper-0.8.14/testsuite/dirname1.cc Examining data/snapper-0.8.14/testsuite/equal-date.cc Examining data/snapper-0.8.14/testsuite/getopts.cc Examining data/snapper-0.8.14/testsuite/humanstring.cc Examining data/snapper-0.8.14/testsuite/json-formatter.cc Examining data/snapper-0.8.14/testsuite/lvm-utils.cc Examining data/snapper-0.8.14/testsuite/qgroup1.cc Examining data/snapper-0.8.14/testsuite/sysconfig-get1.cc Examining data/snapper-0.8.14/testsuite/table-formatter.cc Examining data/snapper-0.8.14/testsuite/table.cc Examining data/snapper-0.8.14/zypp-plugin/forwarding_zypp_plugin.cc Examining data/snapper-0.8.14/zypp-plugin/regex_test.cc Examining data/snapper-0.8.14/zypp-plugin/snapper_zypp_plugin.cc Examining data/snapper-0.8.14/zypp-plugin/solvable_matcher.cc Examining data/snapper-0.8.14/zypp-plugin/solvable_matcher.h Examining data/snapper-0.8.14/zypp-plugin/zypp_commit_plugin.cc Examining data/snapper-0.8.14/zypp-plugin/zypp_commit_plugin.h Examining data/snapper-0.8.14/zypp-plugin/zypp_plugin.cc Examining data/snapper-0.8.14/zypp-plugin/zypp_plugin.h FINAL RESULTS: data/snapper-0.8.14/snapper/AppUtil.cc:118:5: [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(const string& path, string& buf) data/snapper-0.8.14/snapper/AppUtil.cc:121:18: [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 ret = ::readlink(path.c_str(), tmp, sizeof(tmp)); data/snapper-0.8.14/snapper/AppUtil.h:57:13: [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 readlink(const string& path, string& buf); data/snapper-0.8.14/snapper/Btrfs.cc:156:8: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. x.chmod(stat.st_mode & ~0027, 0); data/snapper-0.8.14/snapper/Compare.cc:137:18: [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. bool r1 = file1.readlink(tmp1); data/snapper-0.8.14/snapper/Compare.cc:145:18: [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. bool r2 = file2.readlink(tmp2); data/snapper-0.8.14/snapper/File.cc:339:6: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. if (chown(getAbsolutePath(LOC_SYSTEM).c_str(), owner, group) != 0) data/snapper-0.8.14/snapper/File.cc:346:6: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. if (chmod(getAbsolutePath(LOC_SYSTEM).c_str(), mode) != 0) data/snapper-0.8.14/snapper/File.cc:411:2: [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(getAbsolutePath(LOC_PRE), tmp); data/snapper-0.8.14/snapper/File.cc:523:11: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. if (chmod(getAbsolutePath(LOC_SYSTEM).c_str(), fs.st_mode) != 0) data/snapper-0.8.14/snapper/FileUtils.cc:317:11: [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. SDir::readlink(const string& name, string& buf) const data/snapper-0.8.14/snapper/FileUtils.cc:351:11: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. SDir::chmod(const string& name, mode_t mode, int flags) const data/snapper-0.8.14/snapper/FileUtils.cc:361:11: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. SDir::chown(const string& name, uid_t owner, gid_t group, int flags) const data/snapper-0.8.14/snapper/FileUtils.cc:818:12: [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. SFile::readlink(string& buf) const data/snapper-0.8.14/snapper/FileUtils.cc:820:13: [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. return dir.readlink(name, buf); data/snapper-0.8.14/snapper/FileUtils.cc:825:12: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. SFile::chmod(mode_t mode, int flags) const data/snapper-0.8.14/snapper/FileUtils.cc:827:13: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. return dir.chmod(name, mode, flags); data/snapper-0.8.14/snapper/FileUtils.h:88: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. ssize_t readlink(const string& name, string& buf) const; data/snapper-0.8.14/snapper/FileUtils.h:91:6: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. int chmod(const string& name, mode_t mode, int flags) const; data/snapper-0.8.14/snapper/FileUtils.h:92:6: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. int chown(const string& name, uid_t owner, gid_t group, int flags) const; data/snapper-0.8.14/snapper/FileUtils.h:141: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. ssize_t readlink(string& buf) const; data/snapper-0.8.14/snapper/FileUtils.h:142:6: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. int chmod(mode_t mode, int flags) const; data/snapper-0.8.14/snapper/Snapshot.cc:445:12: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. infos_dir.chmod(decString(num), 0755, 0); data/snapper-0.8.14/zypp-plugin/snapper_zypp_plugin.cc:112:2: [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(sformat("/proc/%d/exe", getppid()), caller_prog); data/snapper-0.8.14/client/cmd-create.cc:186:3: [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. system(command.c_str()); data/snapper-0.8.14/client/installation-helper.cc:115:5: [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. system(("/bin/cp " + tmp_mount.getFullname() + "/etc/snapper/configs/root " + ris + data/snapper-0.8.14/client/mksubvolume.cc:143:5: [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. system("/usr/bin/udevadm settle --timeout 20"); data/snapper-0.8.14/client/mksubvolume.cc:448:9: [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(target.c_str(), F_OK) == 0) data/snapper-0.8.14/client/mksubvolume.cc:457:9: [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(target).c_str(), F_OK) != 0) data/snapper-0.8.14/pam/pam_snapper.c:729:4: [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( snapper_conf, options->homeprefix ); data/snapper-0.8.14/pam/pam_snapper.c:730:4: [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). strcat( snapper_conf, pam_user ); data/snapper-0.8.14/snapper/AppUtil.h:148:68: [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. string sformat(const char* format, ...) __attribute__ ((format(printf, 1, 2))); data/snapper-0.8.14/snapper/AsciiFile.cc:132: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(Name_C.c_str(), F_OK) != 0) data/snapper-0.8.14/snapper/Comparison.cc:239:31: [4] (tmpfile) mktemp: Temporary file race condition (CWE-377). FILE* file = fdopen(info_dir.mktemp(tmp_name), "w"); data/snapper-0.8.14/snapper/Ext4.cc:60: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(CHSNAPBIN, X_OK) != 0) data/snapper-0.8.14/snapper/Ext4.cc:65: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(CHATTRBIN, X_OK) != 0) data/snapper-0.8.14/snapper/FileUtils.cc:406:11: [4] (tmpfile) mktemp: Temporary file race condition (CWE-377). SDir::mktemp(string& name) const data/snapper-0.8.14/snapper/FileUtils.h:99:6: [4] (tmpfile) mktemp: Temporary file race condition (CWE-377). int mktemp(string& name) const; data/snapper-0.8.14/snapper/Hooks.cc:76:61: [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 (subvolume == "/" && filesystem->fstype() == "btrfs" && access(GRUB_SCRIPT, X_OK) == 0) data/snapper-0.8.14/snapper/Hooks.cc:92: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(ROLLBACK_SCRIPT, X_OK) == 0) data/snapper-0.8.14/snapper/Lvm.cc:71: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(LVCREATEBIN, X_OK) != 0) data/snapper-0.8.14/snapper/Lvm.cc:76: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(LVSBIN, X_OK) != 0) data/snapper-0.8.14/snapper/Lvm.cc:81: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(LVCHANGEBIN, X_OK) != 0) data/snapper-0.8.14/snapper/Snapper.cc:336: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(string(CONFIG_TEMPLATE_DIR "/" + template_name).c_str(), R_OK) != 0) data/snapper-0.8.14/snapper/Snapshot.cc:488:20: [4] (tmpfile) mktemp: Temporary file race condition (CWE-377). xml.save(info_dir.mktemp(tmp_name)); data/snapper-0.8.14/snapper/SystemCmd.cc:170:9: [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( Shell_Ci.c_str(), X_OK ) != 0 ) data/snapper-0.8.14/snapper/SystemCmd.cc:238:11: [4] (shell) execle: 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. Ret_i = execle(Shell_Ci.c_str(), Shell_Ci.c_str(), "-c", Cmd.c_str(), nullptr, &env[0]); data/snapper-0.8.14/testsuite-real/common.cc:32:5: [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. system("/usr/bin/find " SUBVOLUME " -mindepth 1 -maxdepth 1 -not -path " SUBVOLUME "/.snapshots " data/snapper-0.8.14/testsuite-real/common.cc:177:16: [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. check_zero(system(tmp.c_str())); data/snapper-0.8.14/testsuite/sysconfig-get1.cc:53:5: [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. system("cp sysconfig-set1.txt sysconfig-set1.txt.tmp"); data/snapper-0.8.14/testsuite/sysconfig-get1.cc:70:23: [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. BOOST_CHECK_EQUAL(system("diff -u sysconfig-set1.txt sysconfig-set1.txt.tmp"), 0); data/snapper-0.8.14/client/cmd-create-config.cc:67:21: [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. string subvolume = realpath(get_opts.pop_arg()); data/snapper-0.8.14/client/utils/GetOpts.cc:66:14: [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. int c = getopt_long(argc, argv, optstring.c_str(), &longopts[0], &option_index); data/snapper-0.8.14/client/utils/Range.cc:46:8: [3] (random) setstate: 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. s.setstate(ios::failbit); data/snapper-0.8.14/client/utils/Range.cc:60:8: [3] (random) setstate: 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. s.setstate(ios::failbit); data/snapper-0.8.14/client/utils/Range.cc:68:8: [3] (random) setstate: 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. s.setstate(ios::failbit); data/snapper-0.8.14/client/utils/Range.cc:74:8: [3] (random) setstate: 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. s.setstate(ios::failbit); data/snapper-0.8.14/client/utils/console.cc:27:26: [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 *cols_env = getenv("COLUMNS"); data/snapper-0.8.14/server/snapperd.cc:229:10: [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. int c = getopt_long(argc, argv, "+sdh", options, &option_index); data/snapper-0.8.14/snapper/AppUtil.cc:136:5: [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 string& path) data/snapper-0.8.14/snapper/AppUtil.cc:138:16: [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* buf = ::realpath(path.c_str(), NULL); data/snapper-0.8.14/snapper/AppUtil.h:60:12: [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. string realpath(const string& path); data/snapper-0.8.14/testsuite/getopts.cc:3:27: [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 BOOST_TEST_MODULE getopt data/snapper-0.8.14/zypp-plugin/snapper_zypp_plugin.cc:86:6: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. s = getenv("SNAPPER_ZYPP_PLUGIN_CONFIG"); data/snapper-0.8.14/zypp-plugin/snapper_zypp_plugin.cc:91:6: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. s = getenv("SNAPPER_ZYPP_PLUGIN_SNAPPER_CONFIG"); data/snapper-0.8.14/zypp-plugin/snapper_zypp_plugin.cc:96:6: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. s = getenv("SNAPPER_ZYPP_PLUGIN_DBUS_SESSION"); data/snapper-0.8.14/zypp-plugin/snapper_zypp_plugin.cc:352:9: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if (getenv("DISABLE_SNAPPER_ZYPP_PLUGIN") != nullptr) { data/snapper-0.8.14/client/Command/ListSnapshots/SnappersData/Table.cc:126:19: [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 sign[2][2] = { { ' ', '-' }, { '+', '*' } }; data/snapper-0.8.14/client/cmd-diff.cc:78:13: [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). file = fopen(opt->second.c_str(), "r"); data/snapper-0.8.14/client/cmd-status.cc:88:13: [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). file = fopen(opt->second.c_str(), "w"); data/snapper-0.8.14/client/cmd-undochange.cc:77:13: [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). file = fopen(opt->second.c_str(), "r"); data/snapper-0.8.14/client/mksubvolume.cc:173:14: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). int fd = open(parent.c_str(), O_RDONLY); data/snapper-0.8.14/client/mksubvolume.cc:280:14: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). int fd = open(target.c_str(), O_RDONLY); data/snapper-0.8.14/client/mksubvolume.cc:470:14: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). int fd = open(fs_target.c_str(), O_RDONLY); data/snapper-0.8.14/client/utils/console.cc:29:16: [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). width = ::atoi (cols_env); data/snapper-0.8.14/dbus/DBusMessage.cc:388: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 s[5]; data/snapper-0.8.14/examples/c/snapper_dbus_cli.c:1051:35: [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). ret = cdbus_del_snap_call(conn, atoi(argv[2])); data/snapper-0.8.14/pam/pam_snapper.c:156: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( out_p, "\\\\", 2 ); data/snapper-0.8.14/pam/pam_snapper.c:159:4: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char s[5]; data/snapper-0.8.14/pam/pam_snapper.c:161: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( out_p, s, 4 ); data/snapper-0.8.14/pam/pam_snapper.c:234:8: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. const char *modestrings[3] = data/snapper-0.8.14/pam/pam_snapper.c:449: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( p, snapshot_num_out, sizeof( *snapshot_num_out ) ); data/snapper-0.8.14/pam/pam_snapper.c:478: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( snapshot_num_out, p, sizeof( *snapshot_num_out ) ); data/snapper-0.8.14/pam/pam_snapper.c:496:8: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. const char *names[4] = { "ruser", "rhost", "tty", "service" }; data/snapper-0.8.14/pam/pam_snapper.c:521: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[bufsize]; data/snapper-0.8.14/snapper/Acls.cc:47: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). int fd = ::open(path.c_str(), O_RDONLY | O_NOFOLLOW | O_NONBLOCK | O_NOATIME | data/snapper-0.8.14/snapper/AppUtil.cc:120:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char tmp[1024]; data/snapper-0.8.14/snapper/AppUtil.cc:227:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf1[100]; data/snapper-0.8.14/snapper/AppUtil.cc:232:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf1[100]; data/snapper-0.8.14/snapper/AppUtil.cc:276: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 + 1]; data/snapper-0.8.14/snapper/AsciiFile.cc:63:9: [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). file = fopen(filename.c_str(), "re"); data/snapper-0.8.14/snapper/BtrfsUtils.cc:200:6: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char path[BTRFS_PATH_NAME_MAX + 1]; data/snapper-0.8.14/snapper/BtrfsUtils.cc:603:15: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). int fd = open(path.c_str(), O_RDONLY); data/snapper-0.8.14/snapper/Compare.cc:65: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). int fd1 = file1.open(O_RDONLY | O_NOFOLLOW | O_NOATIME | O_CLOEXEC); data/snapper-0.8.14/snapper/Compare.cc:72: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). int fd2 = file2.open(O_RDONLY | O_NOFOLLOW | O_NOATIME | O_CLOEXEC); data/snapper-0.8.14/snapper/Compare.cc: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 block1[block_size]; data/snapper-0.8.14/snapper/Compare.cc:88: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 block2[block_size]; data/snapper-0.8.14/snapper/Comparison.cc:181:24: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). int fd = info_dir.open("filelist-" + decString(num1) + ".txt", O_RDONLY | O_NOATIME | data/snapper-0.8.14/snapper/File.cc:360:15: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). int src_fd = open(getAbsolutePath(LOC_PRE).c_str(), O_RDONLY | O_LARGEFILE | O_CLOEXEC); data/snapper-0.8.14/snapper/File.cc:367:16: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). int dest_fd = open(getAbsolutePath(LOC_SYSTEM).c_str(), O_WRONLY | O_LARGEFILE | data/snapper-0.8.14/snapper/FileUtils.cc:64: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). dirfd = ::open(base_path.c_str(), O_RDONLY | O_NOATIME | O_CLOEXEC); data/snapper-0.8.14/snapper/FileUtils.cc:297: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). SDir::open(const string& name, int flags) const data/snapper-0.8.14/snapper/FileUtils.cc:307: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). SDir::open(const string& name, int flags, mode_t mode) const data/snapper-0.8.14/snapper/FileUtils.cc:322:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char tmp[1024]; data/snapper-0.8.14/snapper/FileUtils.cc:430:15: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). int fd = open(name, O_RDWR | O_CREAT | O_EXCL | O_CLOEXEC, S_IRUSR | S_IWUSR); data/snapper-0.8.14/snapper/FileUtils.cc:811: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). SFile::open(int flags) const data/snapper-0.8.14/snapper/FileUtils.cc:813: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). return dir.open(name, flags); data/snapper-0.8.14/snapper/FileUtils.h:86:6: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). int open(const string& name, int flags) const; data/snapper-0.8.14/snapper/FileUtils.h:87:6: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). int open(const string& name, int flags, mode_t mode) const; data/snapper-0.8.14/snapper/FileUtils.h:140:6: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). int open(int flags) const; data/snapper-0.8.14/snapper/Logger.cc:93:12: [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). FILE* f = fopen(logger_data->filename.c_str(), "ae"); data/snapper-0.8.14/snapper/Logger.cc:165:6: [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[bufsize]; data/snapper-0.8.14/snapper/Regex.cc:39: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 error[esize]; data/snapper-0.8.14/snapper/Snapshot.cc:201:21: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). int fd = info_dir.open("info.xml", O_NOFOLLOW | O_CLOEXEC); data/snapper-0.8.14/snapper/SystemCmd.cc:447: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 Buf_ti[BUF_LEN]; data/snapper-0.8.14/testsuite-cmp/cmp.cc:109:25: [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). unsigned int num1 = atoi(argv[3]); data/snapper-0.8.14/testsuite-cmp/cmp.cc:110:25: [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). unsigned int num2 = atoi(argv[4]); data/snapper-0.8.14/testsuite-real/test-btrfsutils.cc:30:14: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). int fd = open("/btrfs", O_NOATIME); data/snapper-0.8.14/client/cleanup.cc:53:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). void read(const ProxyConfig& config, const char* name, Type& value) data/snapper-0.8.14/client/cleanup.cc:68:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(config, "SPACE_LIMIT", space_limit); data/snapper-0.8.14/client/cleanup.cc:69:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(config, "FREE_LIMIT", free_limit); data/snapper-0.8.14/client/cleanup.cc:456:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(config, "NUMBER_MIN_AGE", min_age); data/snapper-0.8.14/client/cleanup.cc:458:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(config, "NUMBER_LIMIT", limit); data/snapper-0.8.14/client/cleanup.cc:459:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(config, "NUMBER_LIMIT_IMPORTANT", limit_important); data/snapper-0.8.14/client/cleanup.cc:580:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(config, "TIMELINE_MIN_AGE", min_age); data/snapper-0.8.14/client/cleanup.cc:582:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(config, "TIMELINE_LIMIT_HOURLY", limit_hourly); data/snapper-0.8.14/client/cleanup.cc:583:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(config, "TIMELINE_LIMIT_DAILY", limit_daily); data/snapper-0.8.14/client/cleanup.cc:584:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(config, "TIMELINE_LIMIT_WEEKLY", limit_weekly); data/snapper-0.8.14/client/cleanup.cc:585:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(config, "TIMELINE_LIMIT_MONTHLY", limit_monthly); data/snapper-0.8.14/client/cleanup.cc:586:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(config, "TIMELINE_LIMIT_YEARLY", limit_yearly); data/snapper-0.8.14/client/cleanup.cc:783:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(config, "EMPTY_PRE_POST_MIN_AGE", min_age); data/snapper-0.8.14/dbus/DBusMainLoop.cc:130:4: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(wakeup_pipe[0], &arbitrary, 1); data/snapper-0.8.14/pam/pam_snapper.c:148: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). char *out = malloc( strlen( in ) * 4 + 1 ); data/snapper-0.8.14/pam/pam_snapper.c:528:28: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). memset( pwd.pw_passwd, 0, strlen( pwd.pw_passwd ) ); data/snapper-0.8.14/pam/pam_snapper.c:602: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). const size_t l = strlen( needle ); data/snapper-0.8.14/pam/pam_snapper.c:727: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). snapper_conf = malloc( strlen( options->homeprefix ) + strlen( pam_user ) + 1 ); data/snapper-0.8.14/pam/pam_snapper.c:727:58: [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). snapper_conf = malloc( strlen( options->homeprefix ) + strlen( pam_user ) + 1 ); data/snapper-0.8.14/server/snapperd.cc:257:5: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(0027); data/snapper-0.8.14/snapper/AppUtil.cc:265:6: [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(buf.domainname) > 0) data/snapper-0.8.14/snapper/AppUtil.cc:318:27: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). memset(pwd.pw_passwd, 0, strlen(pwd.pw_passwd)); data/snapper-0.8.14/snapper/AppUtil.cc:345:27: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). memset(pwd.pw_passwd, 0, strlen(pwd.pw_passwd)); data/snapper-0.8.14/snapper/AppUtil.cc:371:27: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). memset(grp.gr_passwd, 0, strlen(grp.gr_passwd)); data/snapper-0.8.14/snapper/AppUtil.cc:403:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). StopWatch::read() const data/snapper-0.8.14/snapper/AppUtil.cc:415:26: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). return s << fixed << sw.read() << "s"; data/snapper-0.8.14/snapper/AppUtil.cc:422:14: [1] (buffer) equal: 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. return std::equal(std::begin(value), std::end(value), std::begin(rhs.value)); data/snapper-0.8.14/snapper/AppUtil.h:105:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). double read() const; data/snapper-0.8.14/snapper/BtrfsUtils.cc:84:6: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(args.name, name.c_str(), sizeof(args.name) - 1); data/snapper-0.8.14/snapper/BtrfsUtils.cc:99:6: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(args_v2.name, name.c_str(), sizeof(args_v2.name) - 1); data/snapper-0.8.14/snapper/BtrfsUtils.cc:131:6: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(args.name, name.c_str(), sizeof(args.name) - 1); data/snapper-0.8.14/snapper/BtrfsUtils.cc:144:6: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(args.name, name.c_str(), sizeof(args.name) - 1); data/snapper-0.8.14/snapper/Compare.cc:97:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t r1 = read(fd1, block1, t); data/snapper-0.8.14/snapper/Compare.cc:105:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t r2 = read(fd2, block2, t); data/snapper-0.8.14/snapper/Compare.cc:125:9: [1] (buffer) equal: 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. return equal; data/snapper-0.8.14/snapper/FileUtils.cc:454: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). name = string(&t[strlen(t) - name.size()]); data/snapper-0.8.14/snapper/Logger.cc:169:28: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). memset(pwd.pw_passwd, 0, strlen(pwd.pw_passwd)); data/snapper-0.8.14/snapper/Snapper.cc:956:10: [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(m->mnt_dir) >= best_match.length() && is_subpath(subvolume, m->mnt_dir)) data/snapper-0.8.14/snapper/Snapshot.cc:186:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). Snapshots::read() data/snapper-0.8.14/snapper/Snapshot.cc:358:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(); data/snapper-0.8.14/snapper/Snapshot.h:266:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). void read(); data/snapper-0.8.14/snapper/SystemCmd.cc:455:21: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while( (Char_ii=fgetc(File_Cr)) != EOF ) data/snapper-0.8.14/snapper/SystemCmd.cc:580: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). if (strncmp(*v, "LC_ALL=", strlen("LC_ALL=")) != 0 && data/snapper-0.8.14/snapper/SystemCmd.cc:581:28: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). strncmp(*v, "LANGUAGE=", strlen("LANGUAGE=")) != 0) data/snapper-0.8.14/testsuite-cmp/cmp.cc:51:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). t1 = sw1.read(); data/snapper-0.8.14/testsuite-cmp/cmp.cc:73:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). t2 = sw2.read(); data/snapper-0.8.14/testsuite-real/xattrs_utils.cc:11:54: [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). check_zero(lsetxattr(path, name, (void *) value, strlen(value), XATTR_CREATE)); data/snapper-0.8.14/testsuite-real/xattrs_utils.cc:25:54: [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). check_zero(lsetxattr(path, name, (void *) value, strlen(value), XATTR_REPLACE)); ANALYSIS SUMMARY: Hits = 166 Lines analyzed = 39689 in approximately 0.86 seconds (46395 lines/second) Physical Source Lines of Code (SLOC) = 25458 Hits@level = [0] 73 [1] 48 [2] 51 [3] 16 [4] 27 [5] 24 Hits@level+ = [0+] 239 [1+] 166 [2+] 118 [3+] 67 [4+] 51 [5+] 24 Hits/KSLOC@level+ = [0+] 9.38801 [1+] 6.52054 [2+] 4.63509 [3+] 2.63179 [4+] 2.0033 [5+] 0.942729 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.