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/pwgen-2.08/pwgen.h Examining data/pwgen-2.08/sha1.h Examining data/pwgen-2.08/pw_rand.c Examining data/pwgen-2.08/randnum.c Examining data/pwgen-2.08/sha1.c Examining data/pwgen-2.08/pwgen.c Examining data/pwgen-2.08/sha1num.c Examining data/pwgen-2.08/pw_phonemes.c FINAL RESULTS: data/pwgen-2.08/pw_phonemes.c:98:3: [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). strcpy(buf+c, str); data/pwgen-2.08/pw_rand.c:71:3: [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). strcpy(wchars, pw_digits); data/pwgen-2.08/pw_rand.c:75:3: [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). strcpy(wchars, pw_uppers); data/pwgen-2.08/pw_rand.c:78:2: [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). strcpy(wchars, pw_lowers); data/pwgen-2.08/pw_rand.c:81:3: [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). strcpy(wchars, pw_symbols); data/pwgen-2.08/sha1num.c:36:3: [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). strcpy(sha1_seed, seed); data/pwgen-2.08/sha1num.c:44:3: [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). strcpy(sha1_seed, sha1_magic); data/pwgen-2.08/pwgen.c:110:7: [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. c = getopt_long(argc, argv, pw_options, pwgen_options, 0); data/pwgen-2.08/pwgen.c:112:7: [3] (buffer) getopt: 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. c = getopt(argc, argv, pw_options); data/pwgen-2.08/randnum.c:22:15: [3] (random) drand48: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. extern double drand48(void); data/pwgen-2.08/randnum.c:35: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("/dev/urandom", O_RDONLY); data/pwgen-2.08/randnum.c:37: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/random", O_RDONLY | O_NONBLOCK); data/pwgen-2.08/sha1.c:236: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( (void *) (ctx->buffer + left), data/pwgen-2.08/sha1.c:253: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( (void *) (ctx->buffer + left), data/pwgen-2.08/sha1.c:323: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 output[41]; data/pwgen-2.08/sha1.c:325:14: [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[1000]; data/pwgen-2.08/sha1.c:326:14: [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 sha1sum[20]; data/pwgen-2.08/sha1.c:357:17: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf( output + j * 2, "%02x", sha1sum[j] ); data/pwgen-2.08/sha1.c:373:21: [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). if( ! ( f = fopen( argv[1], "rb" ) ) ) data/pwgen-2.08/sha1num.c:19:10: [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 sha1sum[20]; data/pwgen-2.08/sha1num.c:27: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. unsigned char buf[1024]; data/pwgen-2.08/sha1num.c:47: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). if( ! ( f = fopen( sha1, "rb" ) ) ) { data/pwgen-2.08/pw_phonemes.c:78:9: [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(str); data/pwgen-2.08/pw_phonemes.c:149:17: [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). pw_number(strlen(pw_symbols))]; data/pwgen-2.08/pw_rand.c:34:19: [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). memmove(r, r+1, strlen(r)); data/pwgen-2.08/pw_rand.c:55:10: [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(pw_digits); data/pwgen-2.08/pw_rand.c:58:10: [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(pw_uppers); data/pwgen-2.08/pw_rand.c:60:9: [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(pw_lowers); data/pwgen-2.08/pw_rand.c:62:10: [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(pw_symbols); data/pwgen-2.08/pw_rand.c:72:13: [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). wchars += strlen(pw_digits); data/pwgen-2.08/pw_rand.c:76:13: [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). wchars += strlen(pw_uppers); data/pwgen-2.08/pw_rand.c:79:12: [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). wchars += strlen(pw_lowers); data/pwgen-2.08/pw_rand.c:114: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(chars); data/pwgen-2.08/randnum.c:56:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). i = read(fd, cp, nbytes); data/pwgen-2.08/sha1.c:341:30: [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). strlen( msg[i] ) ); data/pwgen-2.08/sha1num.c:31:22: [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). sha1_seed = malloc(strlen(seed)+1); data/pwgen-2.08/sha1num.c:39:22: [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). sha1_seed = malloc(strlen(sha1_magic)+1); data/pwgen-2.08/sha1num.c:71: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). strlen(sha1_seed)); ANALYSIS SUMMARY: Hits = 38 Lines analyzed = 1167 in approximately 0.05 seconds (23303 lines/second) Physical Source Lines of Code (SLOC) = 916 Hits@level = [0] 24 [1] 16 [2] 12 [3] 3 [4] 7 [5] 0 Hits@level+ = [0+] 62 [1+] 38 [2+] 22 [3+] 10 [4+] 7 [5+] 0 Hits/KSLOC@level+ = [0+] 67.6856 [1+] 41.4847 [2+] 24.0175 [3+] 10.917 [4+] 7.64192 [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.