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/enum-1.1/test/main.c Examining data/enum-1.1/src/printing.c Examining data/enum-1.1/src/info.h Examining data/enum-1.1/src/parsing.h Examining data/enum-1.1/src/main.c Examining data/enum-1.1/src/generator.h Examining data/enum-1.1/src/utils.c Examining data/enum-1.1/src/generator.c Examining data/enum-1.1/src/info.c Examining data/enum-1.1/src/assertion.h Examining data/enum-1.1/src/utils.h Examining data/enum-1.1/src/printing.h Examining data/enum-1.1/src/parsing.c Examining data/enum-1.1/thirdparty/glibc-2.11.1/posix/getopt.c Examining data/enum-1.1/thirdparty/glibc-2.11.1/posix/getopt.h FINAL RESULTS: data/enum-1.1/src/assertion.h:57:3: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stderr, \ data/enum-1.1/src/parsing.c:465:3: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(newformat, equal_width_base, total_chars_wanted, precision); data/enum-1.1/src/parsing.c:475:3: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(newformat, default_base, precision); data/enum-1.1/src/parsing.c:653:3: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stderr, format, scaffold->user_precision); data/enum-1.1/src/printing.c:148:9: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. res = fprintf(file, subformat, safety_pointer, safety_pointer, safety_pointer); data/enum-1.1/src/printing.c:151:9: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. res = fprintf(file, subformat, (int)value, safety_pointer, safety_pointer); data/enum-1.1/src/printing.c:154:9: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. res = fprintf(file, subformat, value, safety_pointer, safety_pointer); data/enum-1.1/test/main.c:131: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(TEST_CASE_INDENT "%2d) %8.1f %8.1f\n", i + 1, dest, expected[i]); data/enum-1.1/test/main.c:164:4: [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(TEST_CASE_INDENT "FAILURE (count miscalculated, expected: %d, calculated: %d)\n", exp_len, scaffold.count); data/enum-1.1/src/main.c:146:3: [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. srand(seed); data/enum-1.1/src/parsing.c:132:15: [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. unsigned int random; /**< bool for random usefulness */ data/enum-1.1/src/parsing.c:752: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(original_argc, original_argv, "+b:cef:hi:lnp:rs:t:Vw:z", long_options, &option_index); data/enum-1.1/src/parsing.c:1190:59: [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. if (CHECK_FLAG(dest->flags, FLAG_RANDOM) && (! table[k].random)) { data/enum-1.1/thirdparty/glibc-2.11.1/posix/getopt.c:145:9: [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. #ifndef getenv data/enum-1.1/thirdparty/glibc-2.11.1/posix/getopt.c:146: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. extern char *getenv (); data/enum-1.1/thirdparty/glibc-2.11.1/posix/getopt.c:283:46: [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. d->__posixly_correct = posixly_correct | !!getenv ("POSIXLY_CORRECT"); data/enum-1.1/thirdparty/glibc-2.11.1/posix/getopt.c:1135:1: [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. getopt (int argc, char *const *argv, const char *optstring) data/enum-1.1/thirdparty/glibc-2.11.1/posix/getopt.c:1171:11: [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, "abc:d:0123456789"); data/enum-1.1/thirdparty/glibc-2.11.1/posix/getopt.h:152:12: [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. extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) data/enum-1.1/thirdparty/glibc-2.11.1/posix/getopt.h:161:26: [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. extern int __REDIRECT (getopt, (int ___argc, char *const *___argv, data/enum-1.1/thirdparty/glibc-2.11.1/posix/getopt.h:167:12: [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. # define getopt __posix_getopt data/enum-1.1/thirdparty/glibc-2.11.1/posix/getopt.h:171:12: [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. extern int getopt (); data/enum-1.1/thirdparty/glibc-2.11.1/posix/getopt.h:175:12: [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. extern int getopt_long (int ___argc, char *const *___argv, data/enum-1.1/src/printing.c:138: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). file = fopen("/dev/null", "w"); data/enum-1.1/src/utils.c:197: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 single[255] = { 0, }; data/enum-1.1/src/parsing.c:194: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). const int len = strlen(str); data/enum-1.1/src/parsing.c:242:43: [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 ((*end == 'x') && (end - arg == (int)strlen(arg) - 1)) { data/enum-1.1/src/parsing.c:251:25: [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 (end - arg == (int)strlen(arg)) { data/enum-1.1/src/parsing.c:283: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(str); data/enum-1.1/src/parsing.c:457:29: [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 base_bytes = strlen(equal_width_base) data/enum-1.1/src/parsing.c:458: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). - strlen("%") data/enum-1.1/src/parsing.c:459: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). - strlen("%u") + pre_dot_bytes_needed data/enum-1.1/src/parsing.c:460: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). - strlen("%u") + post_dot_bytes_needed data/enum-1.1/src/parsing.c:468:29: [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 base_bytes = strlen(default_base) data/enum-1.1/src/parsing.c:469: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). - strlen("%") data/enum-1.1/src/parsing.c:470: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). - strlen("%u") + post_dot_bytes_needed data/enum-1.1/src/parsing.c:834: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). if (end - optarg != (int)strlen(optarg) || (strchr(optarg, '-') != NULL)) { data/enum-1.1/src/parsing.c:873: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). if (end - optarg != (int)strlen(optarg) || (strchr(optarg, '-') != NULL)) { data/enum-1.1/src/parsing.c:1028: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). for (j = strlen(p); j > 0; j--) { data/enum-1.1/src/parsing.c:1035:62: [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 (newtype == TOKEN_FLOAT && str[j - 1] == '.' && j != strlen(p)) { data/enum-1.1/src/parsing.c:1215:26: [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). unsigned int flen = strlen(reduced_argv[l]); data/enum-1.1/src/printing.c:142:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(subformat, start, len); data/enum-1.1/src/utils.c:86: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(text); data/enum-1.1/src/utils.c:91:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(dup, text, len); data/enum-1.1/src/utils.c:208:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (read[0]) { data/enum-1.1/src/utils.c:209:50: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). const char replacement = single[(unsigned char)read[1]]; data/enum-1.1/src/utils.c:211:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read[0] != '\\') { data/enum-1.1/src/utils.c:212:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). write[0] = read[0]; data/enum-1.1/src/utils.c:218:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). assert(read[0] == '\\'); data/enum-1.1/src/utils.c:227:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). switch (read[1]) { data/enum-1.1/src/utils.c:243:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((read[2] != '\0') && oct_digit(read[2])) { data/enum-1.1/src/utils.c:243:39: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((read[2] != '\0') && oct_digit(read[2])) { data/enum-1.1/src/utils.c:244:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((read[3] != '\0') && oct_digit(read[3])) { data/enum-1.1/src/utils.c:244:40: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((read[3] != '\0') && oct_digit(read[3])) { data/enum-1.1/src/utils.c:245:32: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). write[0] = 64 * oct_value(read[1]) + 8 * oct_value(read[2]) + oct_value(read[3]); data/enum-1.1/src/utils.c:245:57: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). write[0] = 64 * oct_value(read[1]) + 8 * oct_value(read[2]) + oct_value(read[3]); data/enum-1.1/src/utils.c:245:78: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). write[0] = 64 * oct_value(read[1]) + 8 * oct_value(read[2]) + oct_value(read[3]); data/enum-1.1/src/utils.c:248:31: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). write[0] = 8 * oct_value(read[1]) + oct_value(read[2]); data/enum-1.1/src/utils.c:248:52: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). write[0] = 8 * oct_value(read[1]) + oct_value(read[2]); data/enum-1.1/src/utils.c:252:26: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). write[0] = oct_value(read[1]); data/enum-1.1/src/utils.c:265:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((read[2] != '\0') && hex_digit(read[2])) { data/enum-1.1/src/utils.c:265:39: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((read[2] != '\0') && hex_digit(read[2])) { data/enum-1.1/src/utils.c:266:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((read[3] != '\0') && hex_digit(read[3])) { data/enum-1.1/src/utils.c:266:40: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((read[3] != '\0') && hex_digit(read[3])) { data/enum-1.1/src/utils.c:267:32: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). write[0] = 16 * hex_value(read[2]) + hex_value(read[3]); data/enum-1.1/src/utils.c:267:53: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). write[0] = 16 * hex_value(read[2]) + hex_value(read[3]); data/enum-1.1/src/utils.c:270:27: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). write[0] = hex_value(read[2]); data/enum-1.1/src/utils.c:289:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). write[0] = read[1]; data/enum-1.1/thirdparty/glibc-2.11.1/posix/getopt.c:314: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). int len = d->__nonoption_flags_max_len = strlen (orig_str); data/enum-1.1/thirdparty/glibc-2.11.1/posix/getopt.c:542:21: [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). == (unsigned int) strlen (p->name)) data/enum-1.1/thirdparty/glibc-2.11.1/posix/getopt.c:591:21: [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). d->__nextchar += strlen (d->__nextchar); data/enum-1.1/thirdparty/glibc-2.11.1/posix/getopt.c:664: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). d->__nextchar += strlen (d->__nextchar); data/enum-1.1/thirdparty/glibc-2.11.1/posix/getopt.c:704: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). d->__nextchar += strlen (d->__nextchar); data/enum-1.1/thirdparty/glibc-2.11.1/posix/getopt.c:709:21: [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). d->__nextchar += strlen (d->__nextchar); data/enum-1.1/thirdparty/glibc-2.11.1/posix/getopt.c:899:56: [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 ((unsigned int) (nameend - d->__nextchar) == strlen (p->name)) data/enum-1.1/thirdparty/glibc-2.11.1/posix/getopt.c:944: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). d->__nextchar += strlen (d->__nextchar); data/enum-1.1/thirdparty/glibc-2.11.1/posix/getopt.c:988: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). d->__nextchar += strlen (d->__nextchar); data/enum-1.1/thirdparty/glibc-2.11.1/posix/getopt.c:1026: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). d->__nextchar += strlen (d->__nextchar); data/enum-1.1/thirdparty/glibc-2.11.1/posix/getopt.c:1030: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). d->__nextchar += strlen (d->__nextchar); ANALYSIS SUMMARY: Hits = 79 Lines analyzed = 4764 in approximately 0.15 seconds (32243 lines/second) Physical Source Lines of Code (SLOC) = 2685 Hits@level = [0] 52 [1] 54 [2] 2 [3] 14 [4] 9 [5] 0 Hits@level+ = [0+] 131 [1+] 79 [2+] 25 [3+] 23 [4+] 9 [5+] 0 Hits/KSLOC@level+ = [0+] 48.7896 [1+] 29.4227 [2+] 9.31099 [3+] 8.56611 [4+] 3.35196 [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.