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-sha-1.13/bitfn.h Examining data/ocaml-sha-1.13/sha1.h Examining data/ocaml-sha-1.13/sha1_stubs.c Examining data/ocaml-sha-1.13/sha256.h Examining data/ocaml-sha-1.13/sha256_stubs.c Examining data/ocaml-sha-1.13/sha512.h Examining data/ocaml-sha-1.13/sha512_stubs.c FINAL RESULTS: data/ocaml-sha-1.13/sha1_stubs.c:128:20: [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). #define strdupa(s) strcpy(alloca(strlen(s)+1),s) data/ocaml-sha-1.13/sha256_stubs.c:126:20: [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). #define strdupa(s) strcpy(alloca(strlen(s)+1),s) data/ocaml-sha-1.13/sha512_stubs.c:126:20: [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). #define strdupa(s) strcpy(alloca(strlen(s)+1),s) data/ocaml-sha-1.13/sha1.h:28: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/ocaml-sha-1.13/sha1.h:54: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(dst, src, sizeof(*dst)); data/ocaml-sha-1.13/sha1.h:220: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(ctx->buf + index, data, to_fill); data/ocaml-sha-1.13/sha1.h:233: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(ctx->buf + index, data, len); data/ocaml-sha-1.13/sha1.h:241:18: [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 padding[64] = { 0x80, }; data/ocaml-sha-1.13/sha1_stubs.c:35: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[BLKSIZE]; data/ocaml-sha-1.13/sha1_stubs.c:40: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/ocaml-sha-1.13/sha1_stubs.c:42: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 | O_CLOEXEC); data/ocaml-sha-1.13/sha1_stubs.c:146: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((sha1_digest *)result, &digest, sizeof(sha1_digest)); data/ocaml-sha-1.13/sha256.h:29: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[128]; data/ocaml-sha-1.13/sha256.h: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(dst, src, sizeof(*dst)); data/ocaml-sha-1.13/sha256.h:170: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(ctx->buf + index, data, to_fill); data/ocaml-sha-1.13/sha256.h:183: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(ctx->buf + index, data, len); data/ocaml-sha-1.13/sha256.h:191:18: [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 padding[64] = { 0x80, }; data/ocaml-sha-1.13/sha256_stubs.c:35: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[BLKSIZE]; data/ocaml-sha-1.13/sha256_stubs.c:40: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/ocaml-sha-1.13/sha256_stubs.c:42: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 | O_CLOEXEC); data/ocaml-sha-1.13/sha256_stubs.c:144: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((sha256_digest *)result, &digest, sizeof(sha256_digest)); data/ocaml-sha-1.13/sha512.h:30: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[128]; data/ocaml-sha-1.13/sha512.h:58: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(dst, src, sizeof(*dst)); data/ocaml-sha-1.13/sha512.h:192: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(ctx->buf + index, data, to_fill); data/ocaml-sha-1.13/sha512.h:205: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(ctx->buf + index, data, len); data/ocaml-sha-1.13/sha512.h:213:18: [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 padding[128] = { 0x80, }; data/ocaml-sha-1.13/sha512_stubs.c:35: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[BLKSIZE]; data/ocaml-sha-1.13/sha512_stubs.c:40: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/ocaml-sha-1.13/sha512_stubs.c:42: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 | O_CLOEXEC); data/ocaml-sha-1.13/sha512_stubs.c:144: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((sha512_digest *)result, &digest, sizeof(sha512_digest)); data/ocaml-sha-1.13/sha1_stubs.c:47:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((n = read(fd, buf, BLKSIZE)) > 0) data/ocaml-sha-1.13/sha1_stubs.c:128:34: [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). #define strdupa(s) strcpy(alloca(strlen(s)+1),s) data/ocaml-sha-1.13/sha256_stubs.c:47:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((n = read(fd, buf, BLKSIZE)) > 0) data/ocaml-sha-1.13/sha256_stubs.c:126:34: [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). #define strdupa(s) strcpy(alloca(strlen(s)+1),s) data/ocaml-sha-1.13/sha512_stubs.c:47:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((n = read(fd, buf, BLKSIZE)) > 0) data/ocaml-sha-1.13/sha512_stubs.c:126:34: [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). #define strdupa(s) strcpy(alloca(strlen(s)+1),s) ANALYSIS SUMMARY: Hits = 36 Lines analyzed = 1391 in approximately 0.06 seconds (21604 lines/second) Physical Source Lines of Code (SLOC) = 946 Hits@level = [0] 3 [1] 6 [2] 27 [3] 0 [4] 3 [5] 0 Hits@level+ = [0+] 39 [1+] 36 [2+] 30 [3+] 3 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 41.2262 [1+] 38.055 [2+] 31.7125 [3+] 3.17125 [4+] 3.17125 [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.