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/mac-robber-1.02/mac-robber.c FINAL RESULTS: data/mac-robber-1.02/mac-robber.c:277:20: [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. llen = readlink(curpath, linkpath, LINKPATH_LEN - 1); data/mac-robber-1.02/mac-robber.c:321:18: [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. while ((ch = getopt(argc, argv, "V")) > 0) { data/mac-robber-1.02/mac-robber.c:89: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 hostnamebuf[BUFSIZ]; data/mac-robber-1.02/mac-robber.c:131:5: [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(ls, "----------"); data/mac-robber-1.02/mac-robber.c:251:9: [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 ls[LS_SIZE]; data/mac-robber-1.02/mac-robber.c:231:15: [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). dir_len = strlen(dir); data/mac-robber-1.02/mac-robber.c:247:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(curpath, dir, path_len); data/mac-robber-1.02/mac-robber.c:260:9: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(curpath, dp->d_name, path_len); data/mac-robber-1.02/mac-robber.c:296:13: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is low because the source is a constant character. strncat(curpath, "/", path_len); data/mac-robber-1.02/mac-robber.c:348:15: [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). len = strlen(argv[optind]); data/mac-robber-1.02/mac-robber.c:354:13: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(dir, argv[optind], len + 1); data/mac-robber-1.02/mac-robber.c:355:13: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is low because the source is a constant character. strncat(dir, "/", len + 2); ANALYSIS SUMMARY: Hits = 12 Lines analyzed = 369 in approximately 0.05 seconds (7128 lines/second) Physical Source Lines of Code (SLOC) = 219 Hits@level = [0] 17 [1] 7 [2] 3 [3] 1 [4] 0 [5] 1 Hits@level+ = [0+] 29 [1+] 12 [2+] 5 [3+] 2 [4+] 1 [5+] 1 Hits/KSLOC@level+ = [0+] 132.42 [1+] 54.7945 [2+] 22.8311 [3+] 9.13242 [4+] 4.56621 [5+] 4.56621 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.