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/libpod-2.0.6+dfsg1/libpod/lock/shm/shm_lock.c Examining data/libpod-2.0.6+dfsg1/libpod/lock/shm/shm_lock.h Examining data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c FINAL RESULTS: data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:536:11: [4] (shell) execlp: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. execlp (argv[0], argv[0], NULL); data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:693:3: [4] (shell) execvp: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. execvp (argv[0], argv); data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:917:3: [4] (shell) execvp: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. execvp (argv[0], argv); data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:233:11: [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. pause = getenv ("_PODMAN_PAUSE"); data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:284:21: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. xdg_runtime_dir = getenv ("XDG_RUNTIME_DIR"); data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:777:16: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. listen_pid = getenv("LISTEN_PID"); data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:778:16: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. listen_fds = getenv("LISTEN_FDS"); data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:39: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). ret = open (newpath, O_EXCL|O_CREAT, 0700); data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:121:8: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open ("/proc/self/cmdline", O_RDONLY); data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:254: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). fd = atoi (ent->d_name); data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:290:7: [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[12]; data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:293:7: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char path[PATH_MAX]; data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:296:7: [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 uid_fmt[16]; data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:297:7: [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 gid_fmt[16]; data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:313: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). fd = open (path, O_RDONLY); data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:339:7: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (path, "/proc/%ld/ns/user", pid); data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:340: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). fd = open (path, O_RDONLY); data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:349:7: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (path, "/proc/%ld/ns/mnt", pid); data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:350: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). fd = open (path, O_RDONLY); data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:357:7: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (uid_fmt, "%d", uid); data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:358:7: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (gid_fmt, "%d", gid); data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:462: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. char pid_str[12]; data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:465:11: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (pid_str, "%d", pid); data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:481:16: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). fd = mkstemp (tmp_file_path); data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:523: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). null = open ("/dev/null", O_RDWR); data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:548: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 ns_path[PATH_MAX]; data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:558:10: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). return open (ns_path, O_CLOEXEC | O_RDONLY); data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:574: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 uid[16]; data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:575: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 gid[16]; data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:589:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (uid, "%d", geteuid ()); data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:590:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (gid, "%d", getegid ()); data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:702:8: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fp = fopen (path, "r"); data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:705:7: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[32]; data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:720:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[512]; data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:723:8: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open (file_to_read, O_RDONLY); data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:763: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 uid[16]; data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:764: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 gid[16]; data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:786:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (uid, "%d", geteuid ()); data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:787:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (gid, "%d", getegid ()); data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:847:7: [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[32]; data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:848:7: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (s, "%d", getpid()); data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:131:33: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = TEMP_FAILURE_RETRY (read (fd, buffer + used, allocated - used)); data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:320:31: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). r = TEMP_FAILURE_RETRY (read (fd, buf, sizeof (buf) - 1)); data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:441:31: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). r = TEMP_FAILURE_RETRY (read (p[0], &b, 1)); data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:489:55: [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). r = TEMP_FAILURE_RETRY (write (fd, pid_str, strlen (pid_str))); data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:731:31: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). r = TEMP_FAILURE_RETRY (read (fd, buf, sizeof buf)); data/libpod-2.0.6+dfsg1/pkg/rootless/rootless_linux.c:856:29: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = TEMP_FAILURE_RETRY (read (ready, &b, 1)); ANALYSIS SUMMARY: Hits = 47 Lines analyzed = 1504 in approximately 0.48 seconds (3139 lines/second) Physical Source Lines of Code (SLOC) = 1123 Hits@level = [0] 43 [1] 6 [2] 34 [3] 4 [4] 3 [5] 0 Hits@level+ = [0+] 90 [1+] 47 [2+] 41 [3+] 7 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 80.1425 [1+] 41.8522 [2+] 36.5093 [3+] 6.2333 [4+] 2.67142 [5+] 0 Symlinks skipped = 1 (--allowlink overrides but see doc for security issue) Dot directories skipped = 3 (--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.