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/pstack-1.3.1/pstack.c FINAL RESULTS: data/pstack-1.3.1/pstack.c:485: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). if ((fd = open(fname, O_RDONLY)) < 0) data/pstack-1.3.1/pstack.c:603: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[256]; data/pstack-1.3.1/pstack.c:607: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(buf, "/proc/%d/exe", pid); data/pstack-1.3.1/pstack.c:711: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. static char cmd[128]; data/pstack-1.3.1/pstack.c:717: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(cmd, "/proc/%d/cmdline", pid); data/pstack-1.3.1/pstack.c:718: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). if ((fd = open(cmd, O_RDONLY)) >= 0 && data/pstack-1.3.1/pstack.c:724:7: [2] (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). Risk is low because the source is a constant string. strcpy(&cmd[sizeof(cmd) - 4], "..."); data/pstack-1.3.1/pstack.c:726:27: [2] (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). Risk is low because the source is a constant string. if (fd < 0 || len <= 0) strcpy(cmd, "(command line?)"); data/pstack-1.3.1/pstack.c:435:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd, &shdr, hdr->e_shentsize) != hdr->e_shentsize) data/pstack-1.3.1/pstack.c:446:21: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). (uintN_t) read(fd, syms->symbols, shdr.sh_size) != shdr.sh_size) data/pstack-1.3.1/pstack.c:452:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd, &shdr, hdr->e_shentsize) != hdr->e_shentsize) data/pstack-1.3.1/pstack.c:457:21: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). (uintN_t) read(fd, syms->strings, shdr.sh_size) != shdr.sh_size) data/pstack-1.3.1/pstack.c:466:21: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). (uintN_t) read(fd, syms->dynamic, shdr.sh_size) != shdr.sh_size) data/pstack-1.3.1/pstack.c:491:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd, &hdr, sizeof(hdr)) < (int) sizeof(hdr)) data/pstack-1.3.1/pstack.c:567: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). for (nr = 0; bytes > sizeof(long) && strlen(dp) == nr; data/pstack-1.3.1/pstack.c:719:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). (len = read(fd, cmd, sizeof(cmd))) > 0) { ANALYSIS SUMMARY: Hits = 16 Lines analyzed = 788 in approximately 0.04 seconds (19276 lines/second) Physical Source Lines of Code (SLOC) = 606 Hits@level = [0] 18 [1] 8 [2] 8 [3] 0 [4] 0 [5] 0 Hits@level+ = [0+] 34 [1+] 16 [2+] 8 [3+] 0 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 56.1056 [1+] 26.4026 [2+] 13.2013 [3+] 0 [4+] 0 [5+] 0 Dot directories skipped = 1 (--followdotdir overrides) Minimum risk level = 1 Not every hit is necessarily a security vulnerability. There may be other security vulnerabilities; review your code! See 'Secure Programming HOWTO' (https://dwheeler.com/secure-programs) for more information.