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/cronolog-1.6.2+rpk/lib/localtime_r.c Examining data/cronolog-1.6.2+rpk/lib/strptime.c Examining data/cronolog-1.6.2+rpk/lib/getopt.c Examining data/cronolog-1.6.2+rpk/lib/getopt1.c Examining data/cronolog-1.6.2+rpk/lib/getopt.h Examining data/cronolog-1.6.2+rpk/src/cronoutils.c Examining data/cronolog-1.6.2+rpk/src/cronoutils.h Examining data/cronolog-1.6.2+rpk/src/config.h Examining data/cronolog-1.6.2+rpk/src/cronolog.c Examining data/cronolog-1.6.2+rpk/src/cronotest.c FINAL RESULTS: data/cronolog-1.6.2+rpk/src/cronolog.c:193:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tzbuf, "TZ=%s", optarg); data/cronolog-1.6.2+rpk/src/cronolog.c:254:6: [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, VERSION_MSG); data/cronolog-1.6.2+rpk/src/cronolog.c:259:6: [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, USAGE_MSG, argv[0]); data/cronolog-1.6.2+rpk/src/cronolog.c:266:2: [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, USAGE_MSG, argv[0]); data/cronolog-1.6.2+rpk/src/cronotest.c:178:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf, "TZ=%s", optarg); data/cronolog-1.6.2+rpk/src/cronotest.c:183:6: [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, VERSION_MSG, argv[0]); data/cronolog-1.6.2+rpk/src/cronotest.c:196:6: [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, USAGE_MSG, argv[0]); data/cronolog-1.6.2+rpk/src/cronotest.c:203:2: [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, USAGE_MSG, argv[0]); data/cronolog-1.6.2+rpk/src/cronoutils.c:183:5: [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(lastpath, dirname); data/cronolog-1.6.2+rpk/src/cronoutils.c:690:5: [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(debug_file, msg, ap); data/cronolog-1.6.2+rpk/lib/getopt.c:213:7: [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 *getenv (); data/cronolog-1.6.2+rpk/lib/getopt.c:402:21: [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. posixly_correct = getenv ("POSIXLY_CORRECT"); data/cronolog-1.6.2+rpk/lib/getopt.c:967: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 (argc, argv, optstring) data/cronolog-1.6.2+rpk/lib/getopt.c:997: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/cronolog-1.6.2+rpk/lib/getopt.h:106: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/cronolog-1.6.2+rpk/lib/getopt.h:108: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/cronolog-1.6.2+rpk/lib/getopt.h:110: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, const char *shortopts, data/cronolog-1.6.2+rpk/lib/getopt.h:122: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/cronolog-1.6.2+rpk/lib/getopt.h:123: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 (); data/cronolog-1.6.2+rpk/lib/getopt1.c:68:1: [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. getopt_long (argc, argv, options, long_options, opt_index) data/cronolog-1.6.2+rpk/lib/getopt1.c:124:11: [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, "abc:d:0123456789", data/cronolog-1.6.2+rpk/src/cronolog.c:173:18: [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. while ((ch = getopt_long(argc, argv, short_options, long_options, NULL)) != EOF) data/cronolog-1.6.2+rpk/src/cronolog.c:175:18: [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. while ((ch = getopt(argc, argv, short_options)) != EOF) data/cronolog-1.6.2+rpk/src/cronotest.c:143:18: [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. while ((ch = getopt_long(argc, argv, short_options, long_options, NULL)) != EOF) data/cronolog-1.6.2+rpk/src/cronoutils.h:126:5: [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. int getopt(int argc, char * const argv[], const char *optstring); data/cronolog-1.6.2+rpk/lib/getopt.c:330:4: [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 (new_str, __getopt_nonoption_flags, nonoption_flags_max_len); data/cronolog-1.6.2+rpk/lib/getopt.c:442:5: [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 (__getopt_nonoption_flags, orig_str, len); data/cronolog-1.6.2+rpk/src/cronolog.c:157: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 read_buf[BUFSIZE]; data/cronolog-1.6.2+rpk/src/cronolog.c:158: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 tzbuf[BUFSIZE]; data/cronolog-1.6.2+rpk/src/cronolog.c:159: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 filename[MAX_PATH]; data/cronolog-1.6.2+rpk/src/cronolog.c:249:16: [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). debug_file = fopen(optarg, "a+"); data/cronolog-1.6.2+rpk/src/cronolog.c:398:14: [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). log_fd = open(pfilename, O_WRONLY|O_CREAT|O_APPEND, FILE_MODE); data/cronolog-1.6.2+rpk/src/cronolog.c:404:11: [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). log_fd = open(pfilename, O_WRONLY|O_CREAT|O_APPEND, FILE_MODE); data/cronolog-1.6.2+rpk/src/cronotest.c:137: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 buf[BUFSIZE]; data/cronolog-1.6.2+rpk/src/cronotest.c:138: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 filename[MAX_PATH]; data/cronolog-1.6.2+rpk/src/cronotest.c:219: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). n = atoi(argv[optind]); data/cronolog-1.6.2+rpk/src/cronoutils.c:73: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. extern char *tzname[2]; data/cronolog-1.6.2+rpk/src/cronoutils.c:134: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. static char lastpath[MAX_PATH] = ""; data/cronolog-1.6.2+rpk/src/cronoutils.c:137: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 dirname[MAX_PATH]; data/cronolog-1.6.2+rpk/src/cronoutils.c:148: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(dirname, filename, p - filename); data/cronolog-1.6.2+rpk/src/cronoutils.c:462: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(&tm_initial, tempTime, sizeof(struct tm)); data/cronolog-1.6.2+rpk/src/cronoutils.c:529:6: [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(&tm_adjusted, tempTime, sizeof(struct tm)); data/cronolog-1.6.2+rpk/src/cronoutils.c:701: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. static char buffer[4][80]; data/cronolog-1.6.2+rpk/src/cronoutils.h:112: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). #define open _open data/cronolog-1.6.2+rpk/lib/getopt.c:237: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). extern int strlen (const char *); data/cronolog-1.6.2+rpk/lib/getopt.c:433:44: [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 = nonoption_flags_max_len = strlen (orig_str); data/cronolog-1.6.2+rpk/lib/getopt.c:656: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/cronolog-1.6.2+rpk/lib/getopt.c:680: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). nextchar += strlen (nextchar); data/cronolog-1.6.2+rpk/lib/getopt.c:710: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). nextchar += strlen (nextchar); data/cronolog-1.6.2+rpk/lib/getopt.c:726: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). nextchar += strlen (nextchar); data/cronolog-1.6.2+rpk/lib/getopt.c:731: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). nextchar += strlen (nextchar); data/cronolog-1.6.2+rpk/lib/getopt.c:842:51: [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 - nextchar) == strlen (p->name)) data/cronolog-1.6.2+rpk/lib/getopt.c:865: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). nextchar += strlen (nextchar); data/cronolog-1.6.2+rpk/lib/getopt.c:885: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). nextchar += strlen (nextchar); data/cronolog-1.6.2+rpk/lib/getopt.c:899: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). nextchar += strlen (nextchar); data/cronolog-1.6.2+rpk/lib/getopt.c:903: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). nextchar += strlen (nextchar); data/cronolog-1.6.2+rpk/lib/strptime.c:74: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). ({ size_t len = strlen (cs1); \ data/cronolog-1.6.2+rpk/lib/strptime.c:81: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). (strncasecmp ((cs1), (s2), strlen (cs1)) ? 0 : ((s2) += strlen (cs1), 1)) data/cronolog-1.6.2+rpk/lib/strptime.c:81:59: [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). (strncasecmp ((cs1), (s2), strlen (cs1)) ? 0 : ((s2) += strlen (cs1), 1)) data/cronolog-1.6.2+rpk/lib/strptime.c:106: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). size_t len = strlen (alts); \ data/cronolog-1.6.2+rpk/src/cronolog.c:317:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). n_bytes_read = read(0, read_buf, sizeof read_buf); data/cronolog-1.6.2+rpk/src/cronoutils.c:152:33: [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 (strncmp(dirname, lastpath, strlen(dirname)) == 0) data/cronolog-1.6.2+rpk/src/cronoutils.h:114:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). #define read _read ANALYSIS SUMMARY: Hits = 63 Lines analyzed = 3787 in approximately 0.23 seconds (16821 lines/second) Physical Source Lines of Code (SLOC) = 2411 Hits@level = [0] 48 [1] 19 [2] 19 [3] 15 [4] 10 [5] 0 Hits@level+ = [0+] 111 [1+] 63 [2+] 44 [3+] 25 [4+] 10 [5+] 0 Hits/KSLOC@level+ = [0+] 46.039 [1+] 26.1302 [2+] 18.2497 [3+] 10.3691 [4+] 4.14766 [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.