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/chrpath-0.16/chrpath.c Examining data/chrpath-0.16/main.c Examining data/chrpath-0.16/testsuite/prog.c Examining data/chrpath-0.16/protos.h Examining data/chrpath-0.16/elf.c Examining data/chrpath-0.16/killrpath.c FINAL RESULTS: data/chrpath-0.16/chrpath.c:256:3: [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(rpath, newpath); data/chrpath-0.16/main.c:24:23: [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. # define GETOPT_LONG getopt_long data/chrpath-0.16/main.c:39:52: [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 GETOPT_LONG(argc,argv,optstr,lopts,lidx) getopt(argc,argv,optstr) data/chrpath-0.16/elf.c:49: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). fd = open(filename, flags); data/chrpath-0.16/protos.h:18:12: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char e_ident[EI_NIDENT]; data/chrpath-0.16/chrpath.c:105:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). || read(fd, dyns, PHDR(p_filesz)) != (ssize_t)PHDR(p_filesz)) data/chrpath-0.16/chrpath.c:142:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd, &shdr, sz_shdr) != (ssize_t)sz_shdr) data/chrpath-0.16/chrpath.c:177:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd, strtab, SHDR_O(sh_size)) != (ssize_t)SHDR_O(sh_size)) data/chrpath-0.16/chrpath.c:231:14: [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). rpathlen = strlen(rpath); data/chrpath-0.16/chrpath.c:245:7: [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(newpath) > rpathlen) data/chrpath-0.16/elf.c:56:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd, ehdr, EI_NIDENT) != EI_NIDENT) data/chrpath-0.16/elf.c:80:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd, ((char *)ehdr) + EI_NIDENT, sz_ehdr - EI_NIDENT) data/chrpath-0.16/elf.c:112:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd, phdr, sz_phdr) != (ssize_t)sz_phdr) data/chrpath-0.16/killrpath.c:65:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). || read(fd, dyns, PHDR(p_filesz)) != (ssize_t)PHDR(p_filesz)) ANALYSIS SUMMARY: Hits = 14 Lines analyzed = 773 in approximately 0.09 seconds (8509 lines/second) Physical Source Lines of Code (SLOC) = 619 Hits@level = [0] 25 [1] 9 [2] 2 [3] 2 [4] 1 [5] 0 Hits@level+ = [0+] 39 [1+] 14 [2+] 5 [3+] 3 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 63.0048 [1+] 22.6171 [2+] 8.07754 [3+] 4.84653 [4+] 1.61551 [5+] 0 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.