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/gzrt-0.8/gzrecover.c FINAL RESULTS: data/gzrt-0.8/gzrecover.c:106:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(outfile, "%s.%d", user_outname, suffix++); data/gzrt-0.8/gzrecover.c:108:5: [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(outfile, user_outname); data/gzrt-0.8/gzrecover.c:110:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(outfile, "%s.recovered.%d", infile, suffix++); data/gzrt-0.8/gzrecover.c:112:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(outfile, "%s.recovered", infile); data/gzrt-0.8/gzrecover.c:196:17: [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 ((opt = getopt(argc, argv, optstring)) != -1) data/gzrt-0.8/gzrecover.c:115: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). ofd = open(outfile, O_RDWR | O_CREAT, S_IWUSR | S_IRUSR); data/gzrt-0.8/gzrecover.c:251: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). ifd = open(infile, O_RDONLY); data/gzrt-0.8/gzrecover.c:67:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). rc = read(fd, buf, count); data/gzrt-0.8/gzrecover.c:89:30: [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). outfile = (char *)malloc(strlen(user_outname) + 9); data/gzrt-0.8/gzrecover.c:91:30: [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). outfile = (char *)malloc(strlen(infile) + 25); ANALYSIS SUMMARY: Hits = 10 Lines analyzed = 444 in approximately 0.03 seconds (15345 lines/second) Physical Source Lines of Code (SLOC) = 300 Hits@level = [0] 9 [1] 3 [2] 2 [3] 1 [4] 4 [5] 0 Hits@level+ = [0+] 19 [1+] 10 [2+] 7 [3+] 5 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 63.3333 [1+] 33.3333 [2+] 23.3333 [3+] 16.6667 [4+] 13.3333 [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.