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/liblzf-3.6/crc32.h Examining data/liblzf-3.6/lzf_c.c Examining data/liblzf-3.6/lzf.c Examining data/liblzf-3.6/lzfP.h Examining data/liblzf-3.6/lzf_d.c Examining data/liblzf-3.6/lzf.h FINAL RESULTS: data/liblzf-3.6/lzf.c:437:3: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod (oname, mystat.st_mode); data/liblzf-3.6/lzf.c:343:7: [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 (oname, fname); data/liblzf-3.6/lzf.c:354:7: [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 (oname, fname); data/liblzf-3.6/lzf.c:456:7: [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. p = getenv ("LZF_BLOCKSIZE"); data/liblzf-3.6/lzf.c:474:18: [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. while ((optc = getopt_long (argc, argv, "cdfhvb:", longopts, 0)) != -1) data/liblzf-3.6/lzf.c:476: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 ((optc = getopt (argc, argv, "cdfhvb:")) != -1) data/liblzf-3.6/lzf.c:275:9: [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 (buf1, p, l); data/liblzf-3.6/lzf.c:323: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 (name, O_CREAT | O_WRONLY | O_TRUNC | m, 600); data/liblzf-3.6/lzf.c:344:7: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat (oname, ".lzf"); data/liblzf-3.6/lzf.c:374: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 oname[PATH_MAX + 1]; data/liblzf-3.6/lzf.c:385: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 (fname, O_RDONLY); data/liblzf-3.6/lzf_d.c:153:21: [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 (op, ref, len); data/liblzf-3.6/lzf.c:121:23: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (len && (rc = read (fd, &p[offset], len)) > 0) data/liblzf-3.6/lzf.c:337:11: [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 (fname) > PATH_MAX - 4) data/liblzf-3.6/lzf.c:348:11: [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 (fname) > PATH_MAX) data/liblzf-3.6/lzf.c:355:18: [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). p = &oname[strlen (oname)] - 4; ANALYSIS SUMMARY: Hits = 16 Lines analyzed = 1371 in approximately 0.15 seconds (9317 lines/second) Physical Source Lines of Code (SLOC) = 877 Hits@level = [0] 17 [1] 4 [2] 6 [3] 3 [4] 2 [5] 1 Hits@level+ = [0+] 33 [1+] 16 [2+] 12 [3+] 6 [4+] 3 [5+] 1 Hits/KSLOC@level+ = [0+] 37.6283 [1+] 18.244 [2+] 13.683 [3+] 6.84151 [4+] 3.42075 [5+] 1.14025 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.