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/myrescue-0.9.8/src/myrescue-bitmap2ppm.c Examining data/myrescue-0.9.8/src/myrescue-stat.c Examining data/myrescue-0.9.8/src/myrescue.c Examining data/myrescue-0.9.8/src/permute.c Examining data/myrescue-0.9.8/src/permute.h FINAL RESULTS: data/myrescue-0.9.8/src/myrescue.c:598: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 ( bitmap_name, dst_name ) ; data/myrescue-0.9.8/src/myrescue.c:599:3: [4] (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). strcat ( bitmap_name, bitmap_suffix ) ; data/myrescue-0.9.8/src/myrescue.c:376:2: [3] (random) srandom: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srandom(getpid() ^ time(NULL)); data/myrescue-0.9.8/src/myrescue.c:480:25: [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, "b:B:ASf:r:s:e:J:G:U:F:TRh?" ) ) != -1 ) { data/myrescue-0.9.8/src/myrescue-bitmap2ppm.c:71:7: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). w = atoi(argv[arg]); data/myrescue-0.9.8/src/myrescue-bitmap2ppm.c:76:8: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). y = atoi(argv[arg+1]); data/myrescue-0.9.8/src/myrescue-bitmap2ppm.c:101:7: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). w = atoi(argv[arg]); data/myrescue-0.9.8/src/myrescue-bitmap2ppm.c:104:8: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). y = atoi(argv[arg+1]); data/myrescue-0.9.8/src/myrescue-stat.c:38:11: [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 buffer[BUFFER_SIZE]; data/myrescue-0.9.8/src/myrescue.c:56:7: [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(usb_dev_file, O_WRONLY); data/myrescue-0.9.8/src/myrescue.c:483:17: [2] (integer) atol: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). block_size = atol(optarg); data/myrescue-0.9.8/src/myrescue.c:500:16: [2] (integer) atol: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). skip_fail = atol(optarg); data/myrescue-0.9.8/src/myrescue.c:508:18: [2] (integer) atol: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). retry_count = atol(optarg); data/myrescue-0.9.8/src/myrescue.c:516:18: [2] (integer) atol: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). start_block = atol(optarg); data/myrescue-0.9.8/src/myrescue.c:524:16: [2] (integer) atol: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). end_block = atol(optarg); data/myrescue-0.9.8/src/myrescue.c:532:11: [2] (integer) atol: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). jump = atol(optarg); data/myrescue-0.9.8/src/myrescue.c:540:17: [2] (integer) atol: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). good_range = atol(optarg); data/myrescue-0.9.8/src/myrescue.c:548:19: [2] (integer) atol: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). failed_range = atol(optarg); data/myrescue-0.9.8/src/myrescue-bitmap2ppm.c:110:28: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ( (n < w) && (i = read(fd, buf_bit, w)) > 0 ) data/myrescue-0.9.8/src/myrescue-stat.c:59:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ( (n = read(bitmap_fd, &buffer, BUFFER_SIZE)) > 0 ) { data/myrescue-0.9.8/src/myrescue.c:102:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(bitmap_fd, &c, 1) < 0) { data/myrescue-0.9.8/src/myrescue.c:142:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). src_count = read(src_fd, buffer, block_size); data/myrescue-0.9.8/src/myrescue.c:592:26: [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). bitmap_name = malloc ( strlen(dst_name) + data/myrescue-0.9.8/src/myrescue.c:593:12: [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). strlen(bitmap_suffix) + 1 ) ; ANALYSIS SUMMARY: Hits = 24 Lines analyzed = 1098 in approximately 0.04 seconds (28237 lines/second) Physical Source Lines of Code (SLOC) = 859 Hits@level = [0] 30 [1] 6 [2] 14 [3] 2 [4] 2 [5] 0 Hits@level+ = [0+] 54 [1+] 24 [2+] 18 [3+] 4 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 62.8638 [1+] 27.9395 [2+] 20.9546 [3+] 4.65658 [4+] 2.32829 [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.