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/anacron-2.3/matchrx.h Examining data/anacron-2.3/global.h Examining data/anacron-2.3/gregor.c Examining data/anacron-2.3/gregor.h Examining data/anacron-2.3/lock.c Examining data/anacron-2.3/log.c Examining data/anacron-2.3/main.c Examining data/anacron-2.3/matchrx.c Examining data/anacron-2.3/readtab.c Examining data/anacron-2.3/runjob.c FINAL RESULTS: data/anacron-2.3/log.c:81:11: [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. len = vsnprintf(msg, sizeof(msg), fmt, args); data/anacron-2.3/log.c:83: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(msg + sizeof(msg) - sizeof(truncated), truncated); data/anacron-2.3/readtab.c:137: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(er->assign, env_var); data/anacron-2.3/readtab.c:139: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(er->assign + var_len + 1, value); data/anacron-2.3/readtab.c:173: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(jr->ident, ident); data/anacron-2.3/readtab.c:176: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(jr->command, command); data/anacron-2.3/readtab.c:221: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(jr->ident, ident); data/anacron-2.3/readtab.c:224: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(jr->command, command); data/anacron-2.3/runjob.c:124:5: [4] (shell) execl: 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. execl("/bin/sh", "/bin/sh", "-c", jr->command, (char *)NULL); data/anacron-2.3/runjob.c:183:2: [4] (shell) execl: 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. execl(SENDMAIL, SENDMAIL, "-FAnacron", "-odi", data/anacron-2.3/main.c:109:19: [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 ((opt = getopt(argc, argv, "sfundqt:TS:Vh")) != EOF) data/anacron-2.3/runjob.c:52:9: [3] (tmpfile) tempnam: Temporary file race condition (CWE-377). name = tempnam(NULL, NULL); data/anacron-2.3/runjob.c:229: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. mailto = getenv("MAILTO"); data/anacron-2.3/lock.c:43:24: [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). jr->timestamp_fd = open(jr->ident, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); data/anacron-2.3/lock.c:82: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 timestamp[9]; data/anacron-2.3/lock.c:169: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 stamp[10]; data/anacron-2.3/log.c:50: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. static char msg[MAX_MSG + 1]; data/anacron-2.3/main.c:188: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). rfd = open(file_name, flags); data/anacron-2.3/main.c:465:16: [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). if ((cwd = open ("./", O_RDONLY)) == -1) { data/anacron-2.3/readtab.c:307:11: [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). tab = fopen(anacrontab, "r"); data/anacron-2.3/runjob.c:54:7: [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(name, O_RDWR | O_CREAT | O_EXCL | O_APPEND, data/anacron-2.3/runjob.c:218: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 hostname[512]; data/anacron-2.3/runjob.c:223:7: [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 (hostname,"unknown machine"); data/anacron-2.3/lock.c:89:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). b = read(jr->timestamp_fd, timestamp, 8); data/anacron-2.3/main.c:473:17: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). old_umask = umask(0); data/anacron-2.3/readtab.c:92:6: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = getc(tab); data/anacron-2.3/readtab.c:133:15: [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). var_len = strlen(env_var); data/anacron-2.3/readtab.c:134:15: [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). val_len = strlen(value); data/anacron-2.3/readtab.c:156: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). ident_len = strlen(ident); data/anacron-2.3/readtab.c:157: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). command_len = strlen(command); data/anacron-2.3/readtab.c:196: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). period_len = strlen(periods); data/anacron-2.3/readtab.c:197: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). ident_len = strlen(ident); data/anacron-2.3/readtab.c:198: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). command_len = strlen(command); data/anacron-2.3/runjob.c:120:5: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(old_umask); data/anacron-2.3/runjob.c:133: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). if (write(fd, string, strlen(string)) == -1) data/anacron-2.3/runjob.c:174:2: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(old_umask); ANALYSIS SUMMARY: Hits = 36 Lines analyzed = 2071 in approximately 0.07 seconds (31830 lines/second) Physical Source Lines of Code (SLOC) = 1373 Hits@level = [0] 12 [1] 13 [2] 10 [3] 3 [4] 10 [5] 0 Hits@level+ = [0+] 48 [1+] 36 [2+] 23 [3+] 13 [4+] 10 [5+] 0 Hits/KSLOC@level+ = [0+] 34.9599 [1+] 26.22 [2+] 16.7516 [3+] 9.46832 [4+] 7.28332 [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.