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/ocaml-mad-0.4.6/src/mad_stubs.c FINAL RESULTS: data/ocaml-mad-0.4.6/src/mad_stubs.c:170:14: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). int size = MultiByteToWideChar(CP_UTF8, 0, fname, -1, NULL, 0); data/ocaml-mad-0.4.6/src/mad_stubs.c:178:7: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). if (MultiByteToWideChar(CP_UTF8, 0, fname, -1, wfname, size) == 0) data/ocaml-mad-0.4.6/src/mad_stubs.c:188:14: [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 *fd = fopen(String_val(file), "rb"); data/ocaml-mad-0.4.6/src/mad_stubs.c:197: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 id3_header[3]; data/ocaml-mad-0.4.6/src/mad_stubs.c:383: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(read_start, String_val(Field(data, 0)), read_size); data/ocaml-mad-0.4.6/src/mad_stubs.c:261:44: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). CAMLprim value ocaml_mad_skip_id3tag(value read, value seek, value tell) data/ocaml-mad-0.4.6/src/mad_stubs.c:263:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). CAMLparam3(read,seek,tell); data/ocaml-mad-0.4.6/src/mad_stubs.c:281:23: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = caml_callback(read,Val_int(3)); data/ocaml-mad-0.4.6/src/mad_stubs.c:292:25: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = caml_callback(read,Val_int(3)); data/ocaml-mad-0.4.6/src/mad_stubs.c:303:25: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = caml_callback(read,Val_int(sizeof(uint32_t))); ANALYSIS SUMMARY: Hits = 10 Lines analyzed = 632 in approximately 0.03 seconds (20121 lines/second) Physical Source Lines of Code (SLOC) = 370 Hits@level = [0] 4 [1] 5 [2] 5 [3] 0 [4] 0 [5] 0 Hits@level+ = [0+] 14 [1+] 10 [2+] 5 [3+] 0 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 37.8378 [1+] 27.027 [2+] 13.5135 [3+] 0 [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.