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/paxtest-0.9.15/getshlib.c Examining data/paxtest-0.9.15/randmain2.c Examining data/paxtest-0.9.15/fastrandbody.c Examining data/paxtest-0.9.15/randstack1.c Examining data/paxtest-0.9.15/mprotheap.c Examining data/paxtest-0.9.15/randheap1.c Examining data/paxtest-0.9.15/rettofunc1x.c Examining data/paxtest-0.9.15/getstack.c Examining data/paxtest-0.9.15/mprotdata.c Examining data/paxtest-0.9.15/rettofunc1.c Examining data/paxtest-0.9.15/randmain1.c Examining data/paxtest-0.9.15/execdata.c Examining data/paxtest-0.9.15/randstack2.c Examining data/paxtest-0.9.15/getamap.c Examining data/paxtest-0.9.15/getshlibdelta.c Examining data/paxtest-0.9.15/mprotshdata.c Examining data/paxtest-0.9.15/paxtest.h Examining data/paxtest-0.9.15/shlibtest.c Examining data/paxtest-0.9.15/randarg1.c Examining data/paxtest-0.9.15/randshlib.c Examining data/paxtest-0.9.15/getarg.c Examining data/paxtest-0.9.15/randarg2.c Examining data/paxtest-0.9.15/getmain.c Examining data/paxtest-0.9.15/mprotstack.c Examining data/paxtest-0.9.15/randexhaust2.c Examining data/paxtest-0.9.15/mprotbss.c Examining data/paxtest-0.9.15/getexhaust2.c Examining data/paxtest-0.9.15/shlibbss.c Examining data/paxtest-0.9.15/interp.c Examining data/paxtest-0.9.15/randvdso.c Examining data/paxtest-0.9.15/getexhaust1.c Examining data/paxtest-0.9.15/shlibtest2.c Examining data/paxtest-0.9.15/writetext.c Examining data/paxtest-0.9.15/randheap2.c Examining data/paxtest-0.9.15/body.c Examining data/paxtest-0.9.15/randexhaust1.c Examining data/paxtest-0.9.15/chpax-0.7/io.c Examining data/paxtest-0.9.15/chpax-0.7/aout.c Examining data/paxtest-0.9.15/chpax-0.7/elf64.c Examining data/paxtest-0.9.15/chpax-0.7/flags.c Examining data/paxtest-0.9.15/chpax-0.7/chpax.h Examining data/paxtest-0.9.15/chpax-0.7/elf32.c Examining data/paxtest-0.9.15/chpax-0.7/chpax.c Examining data/paxtest-0.9.15/randshlibdelta2.c Examining data/paxtest-0.9.15/rettofunc2.c Examining data/paxtest-0.9.15/shlibdata.c Examining data/paxtest-0.9.15/mprotshbss.c Examining data/paxtest-0.9.15/getheap.c Examining data/paxtest-0.9.15/randamap.c Examining data/paxtest-0.9.15/body.h Examining data/paxtest-0.9.15/mprotanon.c Examining data/paxtest-0.9.15/execheap.c Examining data/paxtest-0.9.15/randshlibdelta1.c Examining data/paxtest-0.9.15/randbody.c Examining data/paxtest-0.9.15/execstack.c Examining data/paxtest-0.9.15/rettofunc2x.c Examining data/paxtest-0.9.15/shellcode.h Examining data/paxtest-0.9.15/anonmap.c Examining data/paxtest-0.9.15/getvdso.c Examining data/paxtest-0.9.15/execbss.c FINAL RESULTS: data/paxtest-0.9.15/chpax-0.7/flags.c:35:3: [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. printf(USAGE, ptr, CHPAX_VERSION, ptr); data/paxtest-0.9.15/fastrandbody.c:30:8: [4] (shell) popen: 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. fp = popen( testprog, "r" ); data/paxtest-0.9.15/getshlib.c:28:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. void *sprintf; data/paxtest-0.9.15/getshlib.c:34:20: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. printf( "%p\n", sprintf ); data/paxtest-0.9.15/getshlibdelta.c:28:17: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. unsigned long sprintf; data/paxtest-0.9.15/getshlibdelta.c:33:35: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. printf( "%p\n", (void *)(ptr - sprintf) ); data/paxtest-0.9.15/paxtest.h:23:2: [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(dst, src); data/paxtest-0.9.15/randbody.c:35:8: [4] (shell) popen: 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. fp = popen( testprog, "r" ); data/paxtest-0.9.15/body.c:46: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. mode = getenv( "PAXTEST_MODE" ); data/paxtest-0.9.15/chpax-0.7/flags.c:115:10: [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 buffer[7]; data/paxtest-0.9.15/chpax-0.7/io.c:20: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). if ((fd = open(name, flags)) < 0) data/paxtest-0.9.15/execbss.c:15:1: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[MAX_SHELLCODE_LEN]; data/paxtest-0.9.15/execdata.c:15:1: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[MAX_SHELLCODE_LEN] = { 'A' }; data/paxtest-0.9.15/execstack.c:17:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[MAX_SHELLCODE_LEN]; data/paxtest-0.9.15/getvdso.c:27: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("/proc/self/maps", "r"); data/paxtest-0.9.15/getvdso.c:28: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[1024] = { }; data/paxtest-0.9.15/mprotbss.c:17:1: [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[PAGE_SIZE_MAX] __pagealigned; data/paxtest-0.9.15/mprotdata.c:17:1: [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[PAGE_SIZE_MAX] __pagealigned = { 'A' }; data/paxtest-0.9.15/mprotstack.c:19:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[MAX_SHELLCODE_LEN]; data/paxtest-0.9.15/paxtest.h:31:2: [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(dst, src, n); data/paxtest-0.9.15/rettofunc1.c:24: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[sizeof(unsigned long)]; data/paxtest-0.9.15/rettofunc1x.c:24: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[sizeof(unsigned long)]; data/paxtest-0.9.15/rettofunc2.c:23: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[sizeof(unsigned long)]; data/paxtest-0.9.15/rettofunc2x.c:23: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[sizeof(unsigned long)]; data/paxtest-0.9.15/shlibtest.c:9:1: [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 shbss[PAGE_SIZE_MAX] __pagealigned; data/paxtest-0.9.15/shlibtest.c:11:1: [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 shdata[PAGE_SIZE_MAX] __pagealigned = { 'A' }; data/paxtest-0.9.15/shlibtest2.c:9:1: [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 shbss2[PAGE_SIZE_MAX] __pagealigned; data/paxtest-0.9.15/shlibtest2.c:11:1: [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 shdata2[PAGE_SIZE_MAX] __pagealigned = { 'A' }; data/paxtest-0.9.15/chpax-0.7/io.c:28:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). block = read(fd, ptr, size); data/paxtest-0.9.15/rettofunc1.c:26: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((const char *)overflow) > sizeof(overflow[0])) { data/paxtest-0.9.15/rettofunc1x.c:26: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((const char *)overflow) > sizeof(overflow[0])) { ANALYSIS SUMMARY: Hits = 31 Lines analyzed = 2255 in approximately 0.08 seconds (26978 lines/second) Physical Source Lines of Code (SLOC) = 1440 Hits@level = [0] 56 [1] 3 [2] 19 [3] 1 [4] 8 [5] 0 Hits@level+ = [0+] 87 [1+] 31 [2+] 28 [3+] 9 [4+] 8 [5+] 0 Hits/KSLOC@level+ = [0+] 60.4167 [1+] 21.5278 [2+] 19.4444 [3+] 6.25 [4+] 5.55556 [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.