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/shush-1.2.3/src/shush.c Examining data/shush-1.2.3/src/version.h Examining data/shush-1.2.3/src/error.c Examining data/shush-1.2.3/src/check.h Examining data/shush-1.2.3/src/error.h Examining data/shush-1.2.3/src/gethostname.c Examining data/shush-1.2.3/src/cf.c Examining data/shush-1.2.3/src/crontab.c Examining data/shush-1.2.3/src/ifparser.tab.h Examining data/shush-1.2.3/src/os.h Examining data/shush-1.2.3/src/ifparser.h Examining data/shush-1.2.3/src/mmap.h Examining data/shush-1.2.3/src/debug.c Examining data/shush-1.2.3/src/siglist.c Examining data/shush-1.2.3/src/ifparser.lex.c Examining data/shush-1.2.3/src/analyzer.h Examining data/shush-1.2.3/src/crontab.h Examining data/shush-1.2.3/src/siglist.h Examining data/shush-1.2.3/src/variable.c Examining data/shush-1.2.3/src/state.c Examining data/shush-1.2.3/src/ifparser.tab.c Examining data/shush-1.2.3/src/exec.c Examining data/shush-1.2.3/src/exec.h Examining data/shush-1.2.3/src/debug.h Examining data/shush-1.2.3/src/units.c Examining data/shush-1.2.3/src/mmap.c Examining data/shush-1.2.3/src/run.h Examining data/shush-1.2.3/src/cf.h Examining data/shush-1.2.3/src/gethostname.h Examining data/shush-1.2.3/src/ifparser_test.c Examining data/shush-1.2.3/src/state.h Examining data/shush-1.2.3/src/byteset.c Examining data/shush-1.2.3/src/byteset.h Examining data/shush-1.2.3/src/variable.h Examining data/shush-1.2.3/src/units.h Examining data/shush-1.2.3/src/run.c Examining data/shush-1.2.3/src/analyzer.c Examining data/shush-1.2.3/src/check.c FINAL RESULTS: data/shush-1.2.3/src/analyzer.c:305: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(out_md5, err_md5); data/shush-1.2.3/src/crontab.c:257: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(tag, TAG); data/shush-1.2.3/src/crontab.c:259:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tag, "%s [%s]", TAG, cfdir+1); data/shush-1.2.3/src/debug.c:42: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(stderr, format, va); data/shush-1.2.3/src/error.c:60: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(stderr, format, va); data/shush-1.2.3/src/exec.c:46:5: [4] (format) vsprintf: Potential format string problem (CWE-134). Make format string constant. vsprintf(msg, format, va); data/shush-1.2.3/src/exec.c:149:2: [4] (shell) execv: 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. execv(command, cmd); data/shush-1.2.3/src/os.h:30:27: [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). # define strlcpy(x, y, z) strcpy(x, y) data/shush-1.2.3/src/run.c:79: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(stdout, format, va); data/shush-1.2.3/src/run.c:114:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tmp, "%s=%s", var, val); data/shush-1.2.3/src/run.c:406:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(jid, "%s[%s]", job, myid); data/shush-1.2.3/src/run.c:408:9: [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(jid, job); data/shush-1.2.3/src/run.c:529:13: [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(fname, cf_getstr(CF_LOCKFILE)); data/shush-1.2.3/src/run.c:658:25: [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(tmpstr, cf_getstr(CF_LOCK)); data/shush-1.2.3/src/run.c:810:21: [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(tmpstr, cf_getstr(CF_TIMEOUT)); data/shush-1.2.3/src/cf.c:844:13: [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. if (getenv("SHUSH_SENDMAIL") != NULL) data/shush-1.2.3/src/cf.c:845:20: [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. return getenv("SHUSH_SENDMAIL"); data/shush-1.2.3/src/crontab.c:270: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. (getenv("TMPDIR") != NULL) ? getenv("TMPDIR") : _PATH_TMP, data/shush-1.2.3/src/crontab.c:270:36: [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. (getenv("TMPDIR") != NULL) ? getenv("TMPDIR") : _PATH_TMP, data/shush-1.2.3/src/ifparser.tab.c:299: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. if ((yys = getenv("YYDEBUG")) != NULL) data/shush-1.2.3/src/run.c:465:6: [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(getpid()); data/shush-1.2.3/src/run.c:466:14: [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. delay = random() % cf_getnum(CF_RANDOMDELAY); data/shush-1.2.3/src/run.c:697: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. (getenv("TMPDIR") != NULL) ? getenv("TMPDIR") : _PATH_TMP, data/shush-1.2.3/src/run.c:697:36: [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. (getenv("TMPDIR") != NULL) ? getenv("TMPDIR") : _PATH_TMP, data/shush-1.2.3/src/run.c:719:5: [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. (getenv("TMPDIR") != NULL) ? getenv("TMPDIR") : _PATH_TMP, data/shush-1.2.3/src/run.c:719:33: [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. (getenv("TMPDIR") != NULL) ? getenv("TMPDIR") : _PATH_TMP, data/shush-1.2.3/src/shush.c:88:13: [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, "c:Cd:fhH:ikmrR:s:ST:vVu"); data/shush-1.2.3/src/shush.c:189:6: [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. if (getenv("HOME") == NULL) data/shush-1.2.3/src/shush.c:195:43: [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. snprintf(cfdir+1, PATH_MAX, "%s/.shush", getenv("HOME")); data/shush-1.2.3/src/analyzer.c:33:1: [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 out_md5[33], err_md5[33]; data/shush-1.2.3/src/analyzer.c:82: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 buf[1024]; data/shush-1.2.3/src/analyzer.c:184:8: [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(lndup, ln, len - (ln - str)); data/shush-1.2.3/src/analyzer.c:438: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(lndup, ln, nl - str); data/shush-1.2.3/src/analyzer.c:458: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[1024]; data/shush-1.2.3/src/byteset.c:46:10: [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). i = atoi(tok); data/shush-1.2.3/src/byteset.c:57:11: [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). j = atoi(dash + 1); data/shush-1.2.3/src/cf.c:32:1: [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 cf_md5[33]; data/shush-1.2.3/src/cf.c:493: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(lndup, ln, cflen - (ln - conf)); data/shush-1.2.3/src/cf.c:611:7: [2] (integer) atol: 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). atol(val)); data/shush-1.2.3/src/cf.c:622: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 *) globalconfig[i].valid(val)); data/shush-1.2.3/src/cf.c:650:41: [2] (integer) atol: 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). myldup((long **) &reports[rpt+i], atol(val)); data/shush-1.2.3/src/cf.c:660:10: [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 *) reportconfig[i].valid(val)); data/shush-1.2.3/src/cf.c:676: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. (*alist)->value = strdup((char *) reportconfig[i].valid(val)); data/shush-1.2.3/src/cf.c:721:6: [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 *) reports[rpt+CF_RPTNAME]); data/shush-1.2.3/src/cf.c:734:10: [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 *) reports[rpt+CF_RPTNAME]); data/shush-1.2.3/src/cf.c:747:20: [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 *) reports[rpt+CF_RPTNAME]); data/shush-1.2.3/src/cf.c:854: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. return (char *) globalconfig[i].value; data/shush-1.2.3/src/cf.c:916:10: [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. return (char *) reports[report * CF_RPT_MAX + code]; data/shush-1.2.3/src/cf.c:918:10: [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. return (char *) reports[code]; data/shush-1.2.3/src/check.c:37: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 timestr[256]; data/shush-1.2.3/src/check.c:48: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 fname[PATH_MAX], outre[PATH_MAX], errre[PATH_MAX], *outstr, *errstr; data/shush-1.2.3/src/check.c:102: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 *format, *argv[4]; data/shush-1.2.3/src/crontab.c:40: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 cfname[PATH_MAX]; data/shush-1.2.3/src/crontab.c:142: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(lndup, ln, clen - (ln - calendar)); data/shush-1.2.3/src/crontab.c:246: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 tag[PATH_MAX+80], *oldtab, *mytab, newtab[PATH_MAX]; data/shush-1.2.3/src/crontab.c:248: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 *argv[3]; data/shush-1.2.3/src/crontab.c:263:11: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). old = tmpfile(); data/shush-1.2.3/src/crontab.c:272:13: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). newfd = mkstemp(newtab); data/shush-1.2.3/src/exec.c:42: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 msg[1024]; data/shush-1.2.3/src/exec.c:114:12: [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). fd0 = open(_PATH_DEVNULL, O_RDONLY, 0); data/shush-1.2.3/src/gethostname.c:19: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 hostname[MAXHOSTNAMELEN+1]; data/shush-1.2.3/src/ifparser.lex.c:666:27: [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). { ifparser_lval.integer = atoi(ifparser_text); return NUMBER; } data/shush-1.2.3/src/ifparser.lex.c:1622: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((void *)buf, (void *)(inputstr + inputstrcur), count); data/shush-1.2.3/src/mmap.c:31: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_RDONLY, 0); data/shush-1.2.3/src/os.h:41: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(z + i*2, "%.2x", (unsigned char) z[i+16]); \ data/shush-1.2.3/src/run.c:95: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 timestr[256]; data/shush-1.2.3/src/run.c:240: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 buffer[16384]; data/shush-1.2.3/src/run.c:285: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 *smv[4]; data/shush-1.2.3/src/run.c:376: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 fname[PATH_MAX], outlog[PATH_MAX], errlog[PATH_MAX], *outstr, *errstr; data/shush-1.2.3/src/run.c:378: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 *argv[4]; data/shush-1.2.3/src/run.c:532:26: [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). while ((lockfd = open(fname, O_WRONLY|O_CREAT|O_EXCL, 0444)) < 0) data/shush-1.2.3/src/run.c:543:22: [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). lockfd = open(fname, O_RDONLY, 0); data/shush-1.2.3/src/run.c:556:39: [2] (integer) atol: 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). if (lockedlen == 0 || atol(locked) == 0) data/shush-1.2.3/src/run.c:580:41: [2] (integer) atol: 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). jid, (long) atol(locked)); data/shush-1.2.3/src/run.c:581:42: [2] (integer) atol: 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). else if (lockedby != atol(locked)) data/shush-1.2.3/src/run.c:584:41: [2] (integer) atol: 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). jid, (long) atol(locked), (long) lockedby); data/shush-1.2.3/src/run.c:585:32: [2] (integer) atol: 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). lockedby = atol(locked); data/shush-1.2.3/src/run.c:669: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. char mypid[16]; data/shush-1.2.3/src/run.c:672:13: [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(mypid, "%ld\n", (long) getpid()); data/shush-1.2.3/src/run.c:699:13: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). outfd = mkstemp(outlog); data/shush-1.2.3/src/run.c:721:10: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). errfd = mkstemp(errlog); data/shush-1.2.3/src/run.c:822:6: [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). atoi(action+1)); data/shush-1.2.3/src/run.c:824:28: [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). if (kill(child * -1, atoi(action+1)) == 0) data/shush-1.2.3/src/run.c:827:13: [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). jid, atoi(action+1)); data/shush-1.2.3/src/run.c:830:13: [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). jid, atoi(action+1), ERRSTR); data/shush-1.2.3/src/run.c:848:50: [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). debug(DINFO, "Sending signal %d to child", atoi(action+1)); data/shush-1.2.3/src/run.c:850:23: [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). if (kill(child, atoi(action+1)) == 0) data/shush-1.2.3/src/run.c:852:13: [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). jid, atoi(action+1)); data/shush-1.2.3/src/run.c:856:13: [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). jid, atoi(action+1), ERRSTR); data/shush-1.2.3/src/shush.c:74: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 cfdir[PATH_MAX+1], *slfac, *to[3]; data/shush-1.2.3/src/shush.c:104:19: [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). debug_init(atoi(optarg)); data/shush-1.2.3/src/state.c:24: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 statepath[PATH_MAX]; data/shush-1.2.3/src/state.c:45: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 str[1024], lock; data/shush-1.2.3/src/state.c:48:10: [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(statepath, O_RDWR|O_CREAT|O_EXCL, 0644); data/shush-1.2.3/src/units.c:30:24: [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). return 7*24*60*60 * atoi(timestr); data/shush-1.2.3/src/units.c:33:22: [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). return 24*60*60 * atoi(timestr); data/shush-1.2.3/src/units.c:36:19: [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). return 60*60 * atoi(timestr); data/shush-1.2.3/src/units.c:40:16: [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). return 60 * atoi(timestr); data/shush-1.2.3/src/units.c:43:11: [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). return atoi(timestr); data/shush-1.2.3/src/units.c:53: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 timestr[80]; data/shush-1.2.3/src/units.c:62: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(timestr + strlen(timestr), "%uw", data/shush-1.2.3/src/units.c:71: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(timestr + strlen(timestr), "%ud", data/shush-1.2.3/src/units.c:78: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(timestr + strlen(timestr), "%.*uh", data/shush-1.2.3/src/units.c:85: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(timestr + strlen(timestr), "%.*um", data/shush-1.2.3/src/units.c:91: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(timestr + strlen(timestr), "%.*us", width, timeval); data/shush-1.2.3/src/units.c:109:28: [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). return 1024*1024*1024 * atoi(sizestr); data/shush-1.2.3/src/units.c:112:23: [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). return 1024*1024 * atoi(sizestr); data/shush-1.2.3/src/units.c:116:18: [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). return 1024 * atoi(sizestr); data/shush-1.2.3/src/units.c:121:11: [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). return atoi(sizestr); data/shush-1.2.3/src/analyzer.c:507: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). (lndup != NULL) ? strlen(lndup) : nl - ln, data/shush-1.2.3/src/analyzer.c:657:35: [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 (fprintf(mail, "%s", tag) != strlen(tag)) data/shush-1.2.3/src/analyzer.c:678:35: [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 (fprintf(mail, "%s", esc) != strlen(esc)) data/shush-1.2.3/src/cf.c:503:28: [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). else if (*ln == '[' && ln[strlen(ln) - 1] == ']') data/shush-1.2.3/src/cf.c:508: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). ln[strlen(ln) - 1] = '\0'; data/shush-1.2.3/src/crontab.c:214: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). || entry->d_name[strlen(entry->d_name) - 1] == '~') data/shush-1.2.3/src/crontab.c:218: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). if (strlen(entry->d_name) > 7 data/shush-1.2.3/src/crontab.c:219: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). && (strcmp(entry->d_name + strlen(entry->d_name) - 7, data/shush-1.2.3/src/crontab.c:221: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). strcmp(entry->d_name + strlen(entry->d_name) - 7, data/shush-1.2.3/src/crontab.c:260:5: [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(tag, "\n"); data/shush-1.2.3/src/crontab.c:433: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). mytab += strlen(tag); data/shush-1.2.3/src/crontab.c:435:46: [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). && fwrite((void *) mytab, sizeof(char), strlen(mytab), new) data/shush-1.2.3/src/crontab.c:436: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). != strlen(mytab)) data/shush-1.2.3/src/exec.c:48:20: [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). write(fd, msg, strlen(msg)+1); data/shush-1.2.3/src/gethostname.c:43: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). dot = hostname + strlen(hostname) - 1; data/shush-1.2.3/src/ifparser.lex.c:513:14: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ data/shush-1.2.3/src/ifparser.lex.c:1607: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). inputstrlen = strlen(str); data/shush-1.2.3/src/run.c:108: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). tmp = (char *) malloc(strlen(var) + strlen(val) + 2); data/shush-1.2.3/src/run.c:108:41: [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). tmp = (char *) malloc(strlen(var) + strlen(val) + 2); data/shush-1.2.3/src/run.c:329:280: [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). err = fprintf(sm, "\n\"%s\" has timed out while running on host \"%s\".\nProcess %d has been running for %s.\n\nDefined timeout actions are: %s\nPending timeout actions are: %*s\n", jid, get_hostname(0), pid, unit_rtime((u_int) (time(NULL) - start)), cf_getstr(CF_TIMEOUT), strlen(cf_getstr(CF_TIMEOUT)), cf_getstr(CF_TIMEOUT) + ptr); data/shush-1.2.3/src/run.c:336:278: [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). err = fprintf(sm, "\n\"%s\" has been trying to obtain its lock for %s while running on host \"%s\" (process id %d).\n\nDefined lock actions are: %s\nPending lock actions are: %*s\n", jid, unit_rtime((u_int) (time(NULL) - start)), get_hostname(0), pid, cf_getstr(CF_LOCK), strlen(cf_getstr(CF_LOCK)), cf_getstr(CF_LOCK) + ptr); data/shush-1.2.3/src/run.c:399: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). jid = (char *) malloc(strlen(job) + strlen(myid) + 2); data/shush-1.2.3/src/run.c:399:41: [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). jid = (char *) malloc(strlen(job) + strlen(myid) + 2); data/shush-1.2.3/src/run.c:673:38: [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(lockfd, mypid, strlen(mypid) + 1) != strlen(mypid) + 1) data/shush-1.2.3/src/run.c:673:60: [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(lockfd, mypid, strlen(mypid) + 1) != strlen(mypid) + 1) data/shush-1.2.3/src/units.c:62:20: [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(timestr + strlen(timestr), "%uw", data/shush-1.2.3/src/units.c:71:20: [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(timestr + strlen(timestr), "%ud", data/shush-1.2.3/src/units.c:78:20: [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(timestr + strlen(timestr), "%.*uh", data/shush-1.2.3/src/units.c:85:20: [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(timestr + strlen(timestr), "%.*um", data/shush-1.2.3/src/units.c:91:20: [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(timestr + strlen(timestr), "%.*us", width, timeval); ANALYSIS SUMMARY: Hits = 139 Lines analyzed = 7756 in approximately 0.23 seconds (34382 lines/second) Physical Source Lines of Code (SLOC) = 6053 Hits@level = [0] 156 [1] 30 [2] 80 [3] 14 [4] 15 [5] 0 Hits@level+ = [0+] 295 [1+] 139 [2+] 109 [3+] 29 [4+] 15 [5+] 0 Hits/KSLOC@level+ = [0+] 48.7362 [1+] 22.9638 [2+] 18.0076 [3+] 4.79101 [4+] 2.47811 [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.