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-extunix-0.2.0/src/TODO/ftruncate/ftruncateC.c Examining data/ocaml-extunix-0.2.0/src/atfile.c Examining data/ocaml-extunix-0.2.0/src/bigarray.c Examining data/ocaml-extunix-0.2.0/src/common.c Examining data/ocaml-extunix-0.2.0/src/common.h Examining data/ocaml-extunix-0.2.0/src/dirfd.c Examining data/ocaml-extunix-0.2.0/src/endian.c Examining data/ocaml-extunix-0.2.0/src/endian_helper.h Examining data/ocaml-extunix-0.2.0/src/endianba.c Examining data/ocaml-extunix-0.2.0/src/eventfd.c Examining data/ocaml-extunix-0.2.0/src/execinfo.c Examining data/ocaml-extunix-0.2.0/src/fadvise.c Examining data/ocaml-extunix-0.2.0/src/fallocate.c Examining data/ocaml-extunix-0.2.0/src/fexecve.c Examining data/ocaml-extunix-0.2.0/src/fsync.c Examining data/ocaml-extunix-0.2.0/src/ioctl_siocgifconf.c Examining data/ocaml-extunix-0.2.0/src/malloc.c Examining data/ocaml-extunix-0.2.0/src/memalign.c Examining data/ocaml-extunix-0.2.0/src/mktemp.c Examining data/ocaml-extunix-0.2.0/src/mman.c Examining data/ocaml-extunix-0.2.0/src/mount.c Examining data/ocaml-extunix-0.2.0/src/poll.c Examining data/ocaml-extunix-0.2.0/src/pread_pwrite_ba.c Examining data/ocaml-extunix-0.2.0/src/ptrace.c Examining data/ocaml-extunix-0.2.0/src/pts.c Examining data/ocaml-extunix-0.2.0/src/read_cred.c Examining data/ocaml-extunix-0.2.0/src/resource.c Examining data/ocaml-extunix-0.2.0/src/sendmsg.c Examining data/ocaml-extunix-0.2.0/src/signalfd.c Examining data/ocaml-extunix-0.2.0/src/sockopt.c Examining data/ocaml-extunix-0.2.0/src/splice.c Examining data/ocaml-extunix-0.2.0/src/statvfs.c Examining data/ocaml-extunix-0.2.0/src/stdlib.c Examining data/ocaml-extunix-0.2.0/src/sysconf.c Examining data/ocaml-extunix-0.2.0/src/sysinfo.c Examining data/ocaml-extunix-0.2.0/src/syslog.c Examining data/ocaml-extunix-0.2.0/src/time.c Examining data/ocaml-extunix-0.2.0/src/tty_ioctl.c Examining data/ocaml-extunix-0.2.0/src/uname.c Examining data/ocaml-extunix-0.2.0/src/unistd.c Examining data/ocaml-extunix-0.2.0/src/unshare.c FINAL RESULTS: data/ocaml-extunix-0.2.0/src/stdlib.c:17:16: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. char* path = realpath(String_val(v_path),NULL); data/ocaml-extunix-0.2.0/src/stdlib.c:48:7: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. if (realpath(path, resolved_path) == NULL) uerror("realpath", v_path); data/ocaml-extunix-0.2.0/src/unistd.c:484:9: [3] (misc) chroot: chroot can be very helpful, but is hard to use correctly (CWE-250, CWE-22). Make sure the program immediately chdir("/"), closes file descriptors, and drops root privileges, and that all necessary files (and no more!) are in the new root. ret = chroot(p_path); data/ocaml-extunix-0.2.0/src/bigarray.c:15:5: [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(str, buf + off, len); data/ocaml-extunix-0.2.0/src/bigarray.c:26:5: [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(buf + off, str, len); data/ocaml-extunix-0.2.0/src/endian.c:36: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(str + off, &x, sizeof(x)); \ data/ocaml-extunix-0.2.0/src/endianba.c:27: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(buf + off, &x, sizeof(x)); \ data/ocaml-extunix-0.2.0/src/malloc.c:42: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(Bp_val(v_s), buf, size); data/ocaml-extunix-0.2.0/src/sendmsg.c:30: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 control[CMSG_SPACE(sizeof(int))]; /* sizeof sendfd */ data/ocaml-extunix-0.2.0/src/sendmsg.c:60: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(buf, String_val(data_val), datalen); data/ocaml-extunix-0.2.0/src/sendmsg.c:87: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 buf[4096]; data/ocaml-extunix-0.2.0/src/sendmsg.c:92: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 control[CMSG_SPACE(sizeof recvfd)]; data/ocaml-extunix-0.2.0/src/sendmsg.c:144: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(String_val(data), buf, len); data/ocaml-extunix-0.2.0/src/signalfd.c:71: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(Data_custom_val(vret),&ssi,SSI_SIZE); data/ocaml-extunix-0.2.0/src/stdlib.c:47: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 resolved_path[JANE_PATH_MAX]; data/ocaml-extunix-0.2.0/src/time.c:60: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 buf[32]; /* user-supplied buffer which should have room for at least 26 bytes */ data/ocaml-extunix-0.2.0/src/time.c:71: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 buf[256]; data/ocaml-extunix-0.2.0/src/unistd.c:38: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 buf[L_ctermid + 1]; data/ocaml-extunix-0.2.0/src/unistd.c:196: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 iobuf[UNIX_BUFFER_SIZE]; data/ocaml-extunix-0.2.0/src/unistd.c:212: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(&Byte(v_buf, ofs), iobuf, ret); data/ocaml-extunix-0.2.0/src/unistd.c:283: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 iobuf[UNIX_BUFFER_SIZE]; data/ocaml-extunix-0.2.0/src/unistd.c:287: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(iobuf, &Byte(v_buf, ofs), numbytes); data/ocaml-extunix-0.2.0/src/unistd.c:370: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 iobuf[UNIX_BUFFER_SIZE]; data/ocaml-extunix-0.2.0/src/unistd.c:386: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(&Byte(v_buf, ofs), iobuf, ret); data/ocaml-extunix-0.2.0/src/unistd.c:428: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 iobuf[UNIX_BUFFER_SIZE]; data/ocaml-extunix-0.2.0/src/unistd.c:432: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(iobuf, &Byte(v_buf, ofs), numbytes); data/ocaml-extunix-0.2.0/src/pread_pwrite_ba.c:193:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, buf, len); data/ocaml-extunix-0.2.0/src/signalfd.c:66:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). nread = read(Int_val(vfd), &ssi, SSI_SIZE); data/ocaml-extunix-0.2.0/src/unistd.c:375:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, iobuf, numbytes); ANALYSIS SUMMARY: Hits = 29 Lines analyzed = 3862 in approximately 0.11 seconds (33584 lines/second) Physical Source Lines of Code (SLOC) = 2951 Hits@level = [0] 2 [1] 3 [2] 23 [3] 3 [4] 0 [5] 0 Hits@level+ = [0+] 31 [1+] 29 [2+] 26 [3+] 3 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 10.5049 [1+] 9.82718 [2+] 8.81057 [3+] 1.0166 [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.