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/libam7xxx-0.1.7/examples/am7xxx-modeswitch.c Examining data/libam7xxx-0.1.7/examples/am7xxx-play.c Examining data/libam7xxx-0.1.7/examples/picoproj.c Examining data/libam7xxx-0.1.7/src/am7xxx.c Examining data/libam7xxx-0.1.7/src/am7xxx.h Examining data/libam7xxx-0.1.7/src/portable_endian.h Examining data/libam7xxx-0.1.7/src/serialize.c Examining data/libam7xxx-0.1.7/src/serialize.h Examining data/libam7xxx-0.1.7/src/tools.c Examining data/libam7xxx-0.1.7/src/tools.h FINAL RESULTS: data/libam7xxx-0.1.7/src/am7xxx.c:48:31: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define AM7XXX_PRINTF_FORMAT printf data/libam7xxx-0.1.7/src/am7xxx.c:658:3: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, fmt, ap); data/libam7xxx-0.1.7/examples/am7xxx-play.c:714:16: [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, "d:Df:i:o:s:uF:q:l:p:z:h")) != -1) { data/libam7xxx-0.1.7/examples/picoproj.c:80:16: [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, "d:f:F:l:p:z:W:H:h")) != -1) { data/libam7xxx-0.1.7/examples/am7xxx-play.c:481: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 filename[NAME_MAX]; data/libam7xxx-0.1.7/examples/am7xxx-play.c:487:12: [2] (misc) fopen: 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). file = fopen(filename, "wb"); data/libam7xxx-0.1.7/examples/am7xxx-play.c:717:19: [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). device_index = atoi(optarg); data/libam7xxx-0.1.7/examples/am7xxx-play.c:759:21: [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). rescale_method = atoi(optarg); data/libam7xxx-0.1.7/examples/am7xxx-play.c:783:13: [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). format = atoi(optarg); data/libam7xxx-0.1.7/examples/am7xxx-play.c:798:14: [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). quality = atoi(optarg); data/libam7xxx-0.1.7/examples/am7xxx-play.c:806:16: [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). log_level = atoi(optarg); data/libam7xxx-0.1.7/examples/am7xxx-play.c:813:17: [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). power_mode = atoi(optarg); data/libam7xxx-0.1.7/examples/am7xxx-play.c:830:11: [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). zoom = atoi(optarg); data/libam7xxx-0.1.7/examples/picoproj.c:64:2: [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 filename[FILENAME_MAX] = {0}; data/libam7xxx-0.1.7/examples/picoproj.c:83:19: [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). device_index = atoi(optarg); data/libam7xxx-0.1.7/examples/picoproj.c:96:13: [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). format = atoi(optarg); data/libam7xxx-0.1.7/examples/picoproj.c:111:16: [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). log_level = atoi(optarg); data/libam7xxx-0.1.7/examples/picoproj.c:118:17: [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). power_mode = atoi(optarg); data/libam7xxx-0.1.7/examples/picoproj.c:135:11: [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). zoom = atoi(optarg); data/libam7xxx-0.1.7/examples/picoproj.c:152:12: [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). width = atoi(optarg); data/libam7xxx-0.1.7/examples/picoproj.c:160:13: [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). height = atoi(optarg); data/libam7xxx-0.1.7/examples/picoproj.c:185:13: [2] (misc) fopen: 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). image_fp = fopen(filename, "rb"); data/libam7xxx-0.1.7/src/am7xxx.c:514:2: [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(transfer_buffer, buffer, len); data/libam7xxx-0.1.7/src/am7xxx.c:1265:3: [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(device_info, dev->device_info, sizeof(*device_info)); data/libam7xxx-0.1.7/src/serialize.c:57:2: [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(*bufferp, &tmp, sizeof (tmp)); data/libam7xxx-0.1.7/examples/picoproj.c:93:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(filename, optarg, FILENAME_MAX); ANALYSIS SUMMARY: Hits = 26 Lines analyzed = 3349 in approximately 0.14 seconds (23967 lines/second) Physical Source Lines of Code (SLOC) = 2333 Hits@level = [0] 126 [1] 1 [2] 21 [3] 2 [4] 2 [5] 0 Hits@level+ = [0+] 152 [1+] 26 [2+] 25 [3+] 4 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 65.1522 [1+] 11.1444 [2+] 10.7158 [3+] 1.71453 [4+] 0.857265 [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.