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/tfortune-1.0.1/ast.c Examining data/tfortune-1.0.1/err.h Examining data/tfortune-1.0.1/linhash.c Examining data/tfortune-1.0.1/tf.h Examining data/tfortune-1.0.1/tfortune.c Examining data/tfortune-1.0.1/util.c FINAL RESULTS: data/tfortune-1.0.1/ast.c:24:25: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. __attribute__ ((format (printf, 3, 4))) data/tfortune-1.0.1/tf.h:159:25: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. __attribute__ ((format (printf, 3, 4))) data/tfortune-1.0.1/tfortune.c:158:3: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(TF_SEP "%.*s\n", (int)epi->tags.len, epi->tags.base); data/tfortune-1.0.1/tfortune.c:476:2: [4] (shell) execvp: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. execvp(editor, argv); data/tfortune-1.0.1/tfortune.c:986:3: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(PACKAGE " %s\n" data/tfortune-1.0.1/util.c:104:25: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. __attribute__ ((format (printf, 2, 0))) data/tfortune-1.0.1/util.c:113:8: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. ret = vsnprintf(*result, size, fmt, aq); data/tfortune-1.0.1/util.c:121:8: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. ret = vsnprintf(*result, size, fmt, aq); data/tfortune-1.0.1/util.c:127:25: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. __attribute__ ((format (printf, 2, 3))) data/tfortune-1.0.1/util.c:199:25: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. __attribute__ ((format (printf, 2, 3))) data/tfortune-1.0.1/util.c:206:2: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, fmt, argp); data/tfortune-1.0.1/tfortune.c:181:2: [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. srandom((unsigned)tv.tv_usec); data/tfortune-1.0.1/tfortune.c:182:26: [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. r = (num_epis + 0.0) * (random() / (RAND_MAX + 1.0)); data/tfortune-1.0.1/tfortune.c:445:14: [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 *val = getenv("TFORTUNE_EDITOR"); data/tfortune-1.0.1/tfortune.c:449:8: [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. val = getenv("EDITOR"); data/tfortune-1.0.1/ast.c:64: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. unsigned parse_quoted_string(const char *src, const char quote_chars[2], data/tfortune-1.0.1/ast.c:64:53: [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 parse_quoted_string(const char *src, const char quote_chars[2], data/tfortune-1.0.1/tf.h:163: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. unsigned parse_quoted_string(const char *src, const char quote_chars[2], data/tfortune-1.0.1/tf.h:163:53: [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 parse_quoted_string(const char *src, const char quote_chars[2], data/tfortune-1.0.1/tfortune.c:80: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(result, txt, props->chunk->len); data/tfortune-1.0.1/tfortune.c:101: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(titer->str, tags->base, tags->len); data/tfortune-1.0.1/tfortune.c:203: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). ret = open(filename, O_RDONLY); data/tfortune-1.0.1/tfortune.c:567:2: [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 mode[11]; data/tfortune-1.0.1/tfortune.c:582:2: [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(d->mode, "----------"); data/tfortune-1.0.1/tfortune.c:754: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[30]; data/tfortune-1.0.1/util.c:270: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). ret = open(path, 0); data/tfortune-1.0.1/ast.c:67:18: [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). size_t n, len = strlen(src); data/tfortune-1.0.1/tfortune.c:256: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). const size_t sep_len = strlen(TF_SEP); data/tfortune-1.0.1/tfortune.c:684: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). n = strlen(d->user); data/tfortune-1.0.1/tfortune.c:688: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). n = strlen(d->group); data/tfortune-1.0.1/tfortune.c:1064: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(word); data/tfortune-1.0.1/tfortune.c:1087:16: [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). size_t len = strlen(opt); data/tfortune-1.0.1/tfortune.c:1187: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). int len = strlen(*c); data/tfortune-1.0.1/util.c:172:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, iov.iov_base + loaded, iov.iov_len - loaded); ANALYSIS SUMMARY: Hits = 34 Lines analyzed = 3075 in approximately 0.08 seconds (37263 lines/second) Physical Source Lines of Code (SLOC) = 2477 Hits@level = [0] 34 [1] 8 [2] 11 [3] 4 [4] 11 [5] 0 Hits@level+ = [0+] 68 [1+] 34 [2+] 26 [3+] 15 [4+] 11 [5+] 0 Hits/KSLOC@level+ = [0+] 27.4526 [1+] 13.7263 [2+] 10.4966 [3+] 6.05571 [4+] 4.44086 [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.