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/node-tweetnacl-1.0.3+dfsg/test/c/cbox.c Examining data/node-tweetnacl-1.0.3+dfsg/test/c/chash.c Examining data/node-tweetnacl-1.0.3+dfsg/test/c/cscalarmult.c Examining data/node-tweetnacl-1.0.3+dfsg/test/c/csecretbox.c Examining data/node-tweetnacl-1.0.3+dfsg/test/c/csign-keypair.c Examining data/node-tweetnacl-1.0.3+dfsg/test/c/csign.c Examining data/node-tweetnacl-1.0.3+dfsg/test/c/tweetnacl.c Examining data/node-tweetnacl-1.0.3+dfsg/test/c/tweetnacl.h FINAL RESULTS: data/node-tweetnacl-1.0.3+dfsg/test/c/cbox.c:15: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[4096]; data/node-tweetnacl-1.0.3+dfsg/test/c/cbox.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(&msg[have], buf, n); data/node-tweetnacl-1.0.3+dfsg/test/c/chash.c:16: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[4096]; data/node-tweetnacl-1.0.3+dfsg/test/c/chash.c:25: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(&msg[have], buf, n); data/node-tweetnacl-1.0.3+dfsg/test/c/chash.c:41: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 *m, h[crypto_hash_BYTES]; data/node-tweetnacl-1.0.3+dfsg/test/c/cscalarmult.c:52: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 *n, *p, q[crypto_scalarmult_BYTES]; data/node-tweetnacl-1.0.3+dfsg/test/c/csecretbox.c:15: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[4096]; data/node-tweetnacl-1.0.3+dfsg/test/c/csecretbox.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(&msg[have], buf, n); data/node-tweetnacl-1.0.3+dfsg/test/c/csecretbox.c:93: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 *f = fopen("csecretbox_debug.txt", "w"); data/node-tweetnacl-1.0.3+dfsg/test/c/csign-keypair.c:22:9: [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("/dev/urandom",O_RDONLY); data/node-tweetnacl-1.0.3+dfsg/test/c/csign-keypair.c:45: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 pk[crypto_sign_PUBLICKEYBYTES], data/node-tweetnacl-1.0.3+dfsg/test/c/csign.c:16: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[4096]; data/node-tweetnacl-1.0.3+dfsg/test/c/csign.c:25: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(&msg[have], buf, n); data/node-tweetnacl-1.0.3+dfsg/test/c/cbox.c:54:8: [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). len = strlen(h); data/node-tweetnacl-1.0.3+dfsg/test/c/cbox.c:82:6: [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). if (strlen(argv[1]) != crypto_box_SECRETKEYBYTES * 2) data/node-tweetnacl-1.0.3+dfsg/test/c/cbox.c:86:6: [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). if (strlen(argv[2]) != crypto_box_PUBLICKEYBYTES * 2) data/node-tweetnacl-1.0.3+dfsg/test/c/cbox.c:90:6: [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). if (strlen(argv[3]) != crypto_box_NONCEBYTES * 2) data/node-tweetnacl-1.0.3+dfsg/test/c/cscalarmult.c:32:8: [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). len = strlen(h); data/node-tweetnacl-1.0.3+dfsg/test/c/cscalarmult.c:60:6: [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). if (strlen(argv[1]) != crypto_scalarmult_SCALARBYTES * 2) data/node-tweetnacl-1.0.3+dfsg/test/c/cscalarmult.c:64:6: [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). if (strlen(argv[2]) != crypto_scalarmult_SCALARBYTES * 2) data/node-tweetnacl-1.0.3+dfsg/test/c/csecretbox.c:54:8: [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). len = strlen(h); data/node-tweetnacl-1.0.3+dfsg/test/c/csecretbox.c:82:6: [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). if (strlen(argv[1]) != crypto_secretbox_KEYBYTES * 2) data/node-tweetnacl-1.0.3+dfsg/test/c/csecretbox.c:86:6: [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). if (strlen(argv[2]) != crypto_secretbox_NONCEBYTES * 2) data/node-tweetnacl-1.0.3+dfsg/test/c/csign-keypair.c:31:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). i = read(fd,x,i); data/node-tweetnacl-1.0.3+dfsg/test/c/csign.c:52:8: [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). len = strlen(h); data/node-tweetnacl-1.0.3+dfsg/test/c/csign.c:80:6: [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). if (strlen(argv[1]) != crypto_sign_SECRETKEYBYTES * 2) ANALYSIS SUMMARY: Hits = 26 Lines analyzed = 1560 in approximately 0.08 seconds (18855 lines/second) Physical Source Lines of Code (SLOC) = 1367 Hits@level = [0] 7 [1] 13 [2] 13 [3] 0 [4] 0 [5] 0 Hits@level+ = [0+] 33 [1+] 26 [2+] 13 [3+] 0 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 24.1405 [1+] 19.0198 [2+] 9.50988 [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.