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/dadadodo-1.04/parse.c Examining data/dadadodo-1.04/hash.c Examining data/dadadodo-1.04/yarandom.c Examining data/dadadodo-1.04/dadadodo.h Examining data/dadadodo-1.04/parse.h Examining data/dadadodo-1.04/parsei.h Examining data/dadadodo-1.04/files.h Examining data/dadadodo-1.04/generate.h Examining data/dadadodo-1.04/hash.h Examining data/dadadodo-1.04/yarandom.h Examining data/dadadodo-1.04/version.h Examining data/dadadodo-1.04/dadadodo.c Examining data/dadadodo-1.04/files.c Examining data/dadadodo-1.04/generate.c FINAL RESULTS: data/dadadodo-1.04/dadadodo.c:222:4: [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(qp_free_wrap_hack, qp_wrap_hack); data/dadadodo-1.04/dadadodo.c:223:4: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(qp_free_wrap_hack, s); data/dadadodo-1.04/dadadodo.c:943:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf, "%s: opening input file %s", argv[0], input[i]); data/dadadodo-1.04/dadadodo.c:999:4: [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(b, tmp); data/dadadodo-1.04/dadadodo.c:1008:8: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf, "%s: opening %s", argv[0], b); data/dadadodo-1.04/dadadodo.c:1024:8: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf, "%s: opening output file %s", argv[0], output); data/dadadodo-1.04/dadadodo.c:1040:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf, "%s: writing output file %s", argv[0], output); data/dadadodo-1.04/generate.c:249: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 (c2, c1); data/dadadodo-1.04/dadadodo.c:894:16: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. columns_str = getenv("COLUMNS"); data/dadadodo-1.04/dadadodo.c:995:16: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char *tmp = getenv("TMPDIR"); data/dadadodo-1.04/dadadodo.h:41:19: [3] (random) random: 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. #define RAND(N) ((random() & 0x7FFFFFFF) % (N)) data/dadadodo-1.04/generate.c:80:12: [3] (random) random: 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. else if (random() % 4) data/dadadodo-1.04/yarandom.h:15:8: [3] (random) random: 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. #undef random data/dadadodo-1.04/yarandom.h:17:8: [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. #undef drand48 data/dadadodo-1.04/yarandom.h:18:8: [3] (random) srandom: 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. #undef srandom data/dadadodo-1.04/yarandom.h:19:8: [3] (random) srand: 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. #undef srand data/dadadodo-1.04/yarandom.h:31:9: [3] (random) random: 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. #define random() ya_random() data/dadadodo-1.04/yarandom.h:39:9: [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. #define drand48 __ERROR_use_frand_not_drand48_in_xscreensaver__ data/dadadodo-1.04/yarandom.h:40:9: [3] (random) srandom: 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. #define srandom __ERROR_do_not_call_srandom_in_xscreensaver__ data/dadadodo-1.04/yarandom.h:41:9: [3] (random) srand: 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. #define srand __ERROR_do_not_call_srand_in_xscreensaver__ data/dadadodo-1.04/yarandom.h:50:30: [3] (random) random: 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. ({ double tmp = (((double) random()) / \ data/dadadodo-1.04/yarandom.h:58:29: [3] (random) random: 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. (_frand_tmp_ = (((double) random()) / \ data/dadadodo-1.04/dadadodo.c:186:12: [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 [10240]; data/dadadodo-1.04/dadadodo.c:466:3: [2] (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). Risk is low because the source is a constant string. strcpy(s+69, "...\n"); data/dadadodo-1.04/dadadodo.c:671:16: [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 b[255]; data/dadadodo-1.04/dadadodo.c:845:12: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). count = atoi(argv[++i]); data/dadadodo-1.04/dadadodo.c:863:12: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). pause = atoi(argv[++i]); data/dadadodo-1.04/dadadodo.c:899:12: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). columns = atoi(columns_str); data/dadadodo-1.04/dadadodo.c:933:13: [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/dadadodo-1.04/dadadodo.c:940: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). f = fopen (input[i], "r"); data/dadadodo-1.04/dadadodo.c:1002:4: [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(b+strlen(b), "dadadodo.%d", getpid()); data/dadadodo-1.04/dadadodo.c:1004:15: [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). tmp_file = fopen(b, "wb+"); data/dadadodo-1.04/dadadodo.c:1007:8: [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[255]; data/dadadodo-1.04/dadadodo.c:1020:10: [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). out = fopen(output, "wb"); data/dadadodo-1.04/dadadodo.c:1023:8: [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[255]; data/dadadodo-1.04/dadadodo.c:1039:4: [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[255]; data/dadadodo-1.04/dadadodo.c:1053:8: [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). f = fopen(load, "rb"); data/dadadodo-1.04/dadadodo.c:1063:8: [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). f = fopen(output, "rb"); data/dadadodo-1.04/files.c:35:17: [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 write_buf[10240]; data/dadadodo-1.04/files.c:445:38: [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. w->count = NTOHC(((unsigned char *) buf) [0]); data/dadadodo-1.04/files.c:446:38: [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. w->start = NTOHC(((unsigned char *) buf) [1]); data/dadadodo-1.04/files.c:447:38: [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. w->cap = NTOHC(((unsigned char *) buf) [2]); data/dadadodo-1.04/files.c:448:38: [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. w->comma = NTOHC(((unsigned char *) buf) [3]); data/dadadodo-1.04/files.c:449:38: [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. w->period = NTOHC(((unsigned char *) buf) [4]); data/dadadodo-1.04/files.c:450:38: [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. w->quem = NTOHC(((unsigned char *) buf) [5]); data/dadadodo-1.04/files.c:451:38: [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. w->bang = NTOHC(((unsigned char *) buf) [6]); data/dadadodo-1.04/files.c:452:38: [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. w->succ_length = NTOHC(((unsigned char *) buf) [7]); data/dadadodo-1.04/files.c:453:38: [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. w->pred_length = NTOHC(((unsigned char *) buf) [8]); data/dadadodo-1.04/files.c:498:36: [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. al_l->count = NTOHC(((unsigned char *) buf) [j * 2]); data/dadadodo-1.04/files.c:499:36: [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. al_l->word = NTOHC(((unsigned char *) buf) [j * 2 + 1]); data/dadadodo-1.04/files.c:531:36: [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. al_l->count = NTOHC(((unsigned char *) buf) [j * 2]); data/dadadodo-1.04/files.c:532:36: [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. al_l->word = NTOHC(((unsigned char *) buf) [j * 2 + 1]); data/dadadodo-1.04/files.c:599:33: [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. st[i] = NTOHC (((unsigned char *)buf) [i]); data/dadadodo-1.04/generate.c:92:12: [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 [10240]; data/dadadodo-1.04/generate.c:97:12: [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 indent_str[255]; data/dadadodo-1.04/parse.c:44: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 (spool->chars + spool->fp, s, L+1); data/dadadodo-1.04/parsei.h:59:12: [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 chars[STRING_POOL_COUNT]; data/dadadodo-1.04/dadadodo.c:220:14: [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). malloc (strlen(s)+strlen(qp_wrap_hack)+1); data/dadadodo-1.04/dadadodo.c:220:24: [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). malloc (strlen(s)+strlen(qp_wrap_hack)+1); data/dadadodo-1.04/dadadodo.c:229:11: [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). L = strlen(s); data/dadadodo-1.04/dadadodo.c:352:7: [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). L = strlen(s); data/dadadodo-1.04/dadadodo.c:610: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). L = strlen(s); data/dadadodo-1.04/dadadodo.c:672:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(b, s2, s3+1-s2); data/dadadodo-1.04/dadadodo.c:998:24: [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). b = (char *) malloc(strlen(tmp) + 40); data/dadadodo-1.04/dadadodo.c:1000: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). if (b[strlen(b)-1] != '/') data/dadadodo-1.04/dadadodo.c:1001:6: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat(b, "/"); data/dadadodo-1.04/dadadodo.c:1002:14: [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). sprintf(b+strlen(b), "dadadodo.%d", getpid()); data/dadadodo-1.04/files.c:301:40: [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 (!s || strncmp(s, DADADODO_MAGIC, strlen(DADADODO_MAGIC))) data/dadadodo-1.04/files.c:381: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). s += strlen(s) + 1; data/dadadodo-1.04/generate.c:200:27: [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). new_col = *column + strlen (c1) + (punc ? strlen(punc) : 0); data/dadadodo-1.04/generate.c:200:49: [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). new_col = *column + strlen (c1) + (punc ? strlen(punc) : 0); data/dadadodo-1.04/generate.c:225:23: [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). *column = indent + strlen (c1)+1; data/dadadodo-1.04/parse.c:35:11: [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). int L = strlen(s); ANALYSIS SUMMARY: Hits = 73 Lines analyzed = 3189 in approximately 0.12 seconds (26795 lines/second) Physical Source Lines of Code (SLOC) = 2456 Hits@level = [0] 56 [1] 16 [2] 35 [3] 14 [4] 8 [5] 0 Hits@level+ = [0+] 129 [1+] 73 [2+] 57 [3+] 22 [4+] 8 [5+] 0 Hits/KSLOC@level+ = [0+] 52.5244 [1+] 29.7231 [2+] 23.2085 [3+] 8.95765 [4+] 3.25733 [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.