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/sbc-1.4/sbc/sbc_math.h Examining data/sbc-1.4/sbc/sbc_primitives_mmx.c Examining data/sbc-1.4/sbc/sbc.h Examining data/sbc-1.4/sbc/sbc.c Examining data/sbc-1.4/sbc/sbc_primitives_iwmmxt.c Examining data/sbc-1.4/sbc/sbc_primitives_armv6.c Examining data/sbc-1.4/sbc/sbc_primitives_neon.c Examining data/sbc-1.4/sbc/sbc_tables.h Examining data/sbc-1.4/sbc/sbc_primitives_neon.h Examining data/sbc-1.4/sbc/sbc_primitives.c Examining data/sbc-1.4/sbc/sbc_primitives_iwmmxt.h Examining data/sbc-1.4/sbc/sbc_private.h Examining data/sbc-1.4/sbc/sbc_primitives_mmx.h Examining data/sbc-1.4/sbc/sbc_primitives_armv6.h Examining data/sbc-1.4/sbc/sbc_primitives.h Examining data/sbc-1.4/src/sbcdec.c Examining data/sbc-1.4/src/sbcinfo.c Examining data/sbc-1.4/src/sbctester.c Examining data/sbc-1.4/src/formats.h Examining data/sbc-1.4/src/sbcenc.c FINAL RESULTS: data/sbc-1.4/src/sbcdec.c:258:16: [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 ((opt = getopt_long(argc, argv, "+hmvd:f:", data/sbc-1.4/src/sbcenc.c:262:16: [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 ((opt = getopt_long(argc, argv, "+hmvs:b:jdSB:", data/sbc-1.4/sbc/sbc.c:658:4: [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(v + 80, v, 9 * sizeof(*v)); data/sbc-1.4/sbc/sbc_primitives.c:255:4: [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(&X[0][SBC_X_BUFFER_SIZE - 40], &X[0][position], data/sbc-1.4/sbc/sbc_primitives.c:258:4: [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(&X[1][SBC_X_BUFFER_SIZE - 40], &X[1][position], data/sbc-1.4/sbc/sbc_primitives.c:306:4: [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(&X[0][SBC_X_BUFFER_SIZE - 72], &X[0][position], data/sbc-1.4/sbc/sbc_primitives.c:309:4: [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(&X[1][SBC_X_BUFFER_SIZE - 72], &X[1][position], data/sbc-1.4/src/sbcdec.c:51: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 buf[BUF_SIZE], *stream; data/sbc-1.4/src/sbcdec.c:73: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(filename, O_RDONLY); data/sbc-1.4/src/sbcdec.c:93: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). ad = open(output, O_WRONLY | O_CREAT | O_TRUNC, 0644); data/sbc-1.4/src/sbcdec.c:95: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). ad = open(output, O_WRONLY, 0); data/sbc-1.4/src/sbcenc.c:47:17: [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. static unsigned char input[BUF_SIZE], output[BUF_SIZE + BUF_SIZE / 4]; data/sbc-1.4/src/sbcenc.c:65: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(filename, O_RDONLY); data/sbc-1.4/src/sbcenc.c:278:15: [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). subbands = atoi(optarg); data/sbc-1.4/src/sbcenc.c:286: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). bitpool = atoi(optarg); data/sbc-1.4/src/sbcenc.c:302: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). blocks = atoi(optarg); data/sbc-1.4/src/sbcinfo.c:174: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 buf[64]; data/sbc-1.4/src/sbcinfo.c:186: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(filename, O_RDONLY); data/sbc-1.4/src/sbctester.c:87:9: [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). csv = fopen(csvname, "wt"); data/sbc-1.4/src/sbctester.c:283:29: [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). db = sampletobits((short) atoi(argv[1]), 1); data/sbc-1.4/src/sbcdec.c:80:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd, stream, st.st_size) != st.st_size) { data/sbc-1.4/src/sbcenc.c:74:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). len = read(fd, &au_hdr, sizeof(au_hdr)); data/sbc-1.4/src/sbcenc.c:153:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd, input, BE_INT(au_hdr.hdr_size) - len) < 0) data/sbc-1.4/src/sbcenc.c:172:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). size = read(fd, input, codesize * nframes); data/sbc-1.4/src/sbcinfo.c:158:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). len = read(fd, buf + pos, count); ANALYSIS SUMMARY: Hits = 25 Lines analyzed = 6603 in approximately 0.23 seconds (28630 lines/second) Physical Source Lines of Code (SLOC) = 5056 Hits@level = [0] 98 [1] 5 [2] 18 [3] 2 [4] 0 [5] 0 Hits@level+ = [0+] 123 [1+] 25 [2+] 20 [3+] 2 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 24.3275 [1+] 4.94462 [2+] 3.9557 [3+] 0.39557 [4+] 0 [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.