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/watchdog-5.16/src/pidfile.c
Examining data/watchdog-5.16/src/send-email.c
Examining data/watchdog-5.16/src/wd_keepalive.c
Examining data/watchdog-5.16/src/wd_identify.c
Examining data/watchdog-5.16/src/iface.c
Examining data/watchdog-5.16/src/configfile.c
Examining data/watchdog-5.16/src/keep_alive.c
Examining data/watchdog-5.16/src/heartbeat.c
Examining data/watchdog-5.16/src/shutdown.c
Examining data/watchdog-5.16/src/temp.c
Examining data/watchdog-5.16/src/file_stat.c
Examining data/watchdog-5.16/src/gettime.c
Examining data/watchdog-5.16/src/load.c
Examining data/watchdog-5.16/src/file_table.c
Examining data/watchdog-5.16/src/watchdog.c
Examining data/watchdog-5.16/src/lock_mem.c
Examining data/watchdog-5.16/src/errorcodes.c
Examining data/watchdog-5.16/src/net.c
Examining data/watchdog-5.16/src/run-as-child.c
Examining data/watchdog-5.16/src/read-conf.c
Examining data/watchdog-5.16/src/killall5.c
Examining data/watchdog-5.16/src/sigterm.c
Examining data/watchdog-5.16/src/daemon-pid.c
Examining data/watchdog-5.16/src/test_binary.c
Examining data/watchdog-5.16/src/reopenstd.c
Examining data/watchdog-5.16/src/memory.c
Examining data/watchdog-5.16/src/logmessage.c
Examining data/watchdog-5.16/src/xmalloc.c
Examining data/watchdog-5.16/include/gettime.h
Examining data/watchdog-5.16/include/xmalloc.h
Examining data/watchdog-5.16/include/read-conf.h
Examining data/watchdog-5.16/include/watch_err.h
Examining data/watchdog-5.16/include/logmessage.h
Examining data/watchdog-5.16/include/ext2_mnt.h
Examining data/watchdog-5.16/include/extern.h

FINAL RESULTS:

data/watchdog-5.16/include/logmessage.h:55:61:  [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.
#define PRINTF_STYLE(Fmt, FirstArg) __attribute__ ((format (printf, Fmt, FirstArg)))
data/watchdog-5.16/src/heartbeat.c:65:4:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
			sprintf(rbuf, "%*s\n", TS_SIZE - 1, "--restart--");
data/watchdog-5.16/src/heartbeat.c:96:3:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
		sprintf(tbufw, "%*s\n", TS_SIZE - 1, tbuf);
data/watchdog-5.16/src/logmessage.c:128:2:  [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.
	vsnprintf(buf, sizeof(buf) - 1, fmt, args);
data/watchdog-5.16/src/logmessage.c:130:2:  [4] (format) vsprintf:
  Potential format string problem (CWE-134). Make format string constant.
	vsprintf(buf, fmt, args);
data/watchdog-5.16/src/logmessage.c:152:2:  [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.
	vsnprintf(buf, sizeof(buf) - 1, fmt, args);
data/watchdog-5.16/src/logmessage.c:154:2:  [4] (format) vsprintf:
  Potential format string problem (CWE-134). Make format string constant.
	vsprintf(buf, fmt, args);
data/watchdog-5.16/src/reopenstd.c:66:3:  [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(filename_buf, dname);
data/watchdog-5.16/src/reopenstd.c:97:12:  [4] (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).
			rname = strcat(filename_buf, fnames[idx]);
data/watchdog-5.16/src/reopenstd.c:98:12:  [4] (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).
			rname = strcat(rname, sfx);
data/watchdog-5.16/src/run-as-child.c:104:11:  [4] (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).
				opt = strcat(opt, arg[ii]);
data/watchdog-5.16/src/run-as-child.c:118:3:  [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(path, arg + 1);
data/watchdog-5.16/src/send-email.c:51:8:  [4] (shell) popen:
  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.
		ph = popen(exe, "w");
data/watchdog-5.16/src/test_binary.c:273:4:  [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(tbinary, tbinary, NULL);
data/watchdog-5.16/src/test_binary.c:275:4:  [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(tbinary, tbinary, "test", NULL);
data/watchdog-5.16/src/watchdog.c:370:14:  [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 ((c = getopt_long(argc, argv, opts, long_options, NULL)) != EOF) {
data/watchdog-5.16/src/wd_identify.c:55:14:  [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 ((c = getopt_long(argc, argv, opts, long_options, NULL)) != EOF) {
data/watchdog-5.16/src/wd_keepalive.c:102:14:  [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 ((c = getopt_long(argc, argv, opts, long_options, NULL)) != EOF) {
data/watchdog-5.16/src/configfile.c:174:12:  [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).
	if ((wc = fopen(configfile, "r")) == NULL) {
data/watchdog-5.16/src/configfile.c:344: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 fname[PATH_MAX];
data/watchdog-5.16/src/daemon-pid.c:40:13:  [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 *fp = fopen(fname, "r");
data/watchdog-5.16/src/daemon-pid.c:82:7:  [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).
	fp = fopen(fname, "w");
data/watchdog-5.16/src/file_stat.c:41:4:  [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 text[25];
data/watchdog-5.16/src/file_table.c:19: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(fname, O_RDONLY);
data/watchdog-5.16/src/heartbeat.c:46:15:  [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).
		hb = ((hb = fopen(heartbeat, "r+")) == NULL) ? fopen(heartbeat, "w+") : hb;
data/watchdog-5.16/src/heartbeat.c:46:50:  [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).
		hb = ((hb = fopen(heartbeat, "r+")) == NULL) ? fopen(heartbeat, "w+") : hb;
data/watchdog-5.16/src/heartbeat.c:51:4:  [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 rbuf[TS_SIZE + 1];
data/watchdog-5.16/src/heartbeat.c:60: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(timestamps + (TS_SIZE * lastts), rbuf, TS_SIZE);
data/watchdog-5.16/src/heartbeat.c:66: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(timestamps + (lastts * TS_SIZE), rbuf, TS_SIZE);
data/watchdog-5.16/src/heartbeat.c:81: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 tbuf[TS_SIZE + 1];
data/watchdog-5.16/src/heartbeat.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 tbufw[TS_SIZE + 2];
data/watchdog-5.16/src/heartbeat.c:98: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(timestamps + (lastts * TS_SIZE), tbufw, TS_SIZE);
data/watchdog-5.16/src/iface.c:17:15:  [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 *file = fopen(fname, "r");
data/watchdog-5.16/src/iface.c:27:3:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
		char line[NETDEV_LINE_LEN];
data/watchdog-5.16/src/keep_alive.c:49:17:  [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).
		watchdog_fd = open(name, O_WRONLY | O_CLOEXEC);
data/watchdog-5.16/src/killall5.c:48: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 fname[1024];
data/watchdog-5.16/src/killall5.c:56:13:  [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).
			dmp_fp = fopen(fname, "w");	/* First time open and truncate file */
data/watchdog-5.16/src/killall5.c:58:13:  [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).
			dmp_fp = fopen(fname, "a+"); /* Then append for writing. */
data/watchdog-5.16/src/killall5.c:74:3:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
		char cmd[1024];
data/watchdog-5.16/src/killall5.c:152: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 fname[BUFFER_SIZE];
data/watchdog-5.16/src/killall5.c:159: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(fname, O_RDONLY);
data/watchdog-5.16/src/killall5.c:215: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[BUFFER_SIZE];
data/watchdog-5.16/src/killall5.c:278: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).
		if ((act_pid = atoi(d->d_name)) == 0)
data/watchdog-5.16/src/killall5.c:313: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 path[128];
data/watchdog-5.16/src/load.c:34:13:  [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).
		load_fd = open(load_name, O_RDONLY);
data/watchdog-5.16/src/load.c:50: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[40], *ptr;
data/watchdog-5.16/src/load.c:73:9:  [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).
	avg1 = atoi(buf);
data/watchdog-5.16/src/load.c:79: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).
		avg5 = atoi(ptr);
data/watchdog-5.16/src/load.c:84: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).
		avg15 = atoi(ptr);
data/watchdog-5.16/src/lock_mem.c:46: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[256];
data/watchdog-5.16/src/lock_mem.c:74: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).
				fp = fopen(buf, "w");
data/watchdog-5.16/src/lock_mem.c:88: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).
				fp = fopen(buf, "w");
data/watchdog-5.16/src/logmessage.c:32: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 progname[MAX_PROG_NAME];
data/watchdog-5.16/src/logmessage.c:36: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 err_buf[MAX_MESSAGE];
data/watchdog-5.16/src/logmessage.c:121: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[MAX_MESSAGE];
data/watchdog-5.16/src/logmessage.c:145: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[MAX_MESSAGE];
data/watchdog-5.16/src/memory.c:59:9:  [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).
		res = atol(ptr + strlen(var));
data/watchdog-5.16/src/memory.c:88: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).
		mem_fd = open(mem_name, O_RDONLY);
data/watchdog-5.16/src/memory.c:106: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[2048];
data/watchdog-5.16/src/net.c:71:11:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
	unsigned char outpack[MAXPACKET];
data/watchdog-5.16/src/pidfile.c:17: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).
	int fd = open(file->name, O_RDONLY), pid;
data/watchdog-5.16/src/pidfile.c:18: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[20];
data/watchdog-5.16/src/pidfile.c:46:8:  [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).
	pid = atoi(buf);
data/watchdog-5.16/src/read-conf.c:125: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).
			int ii = atoi(val);
data/watchdog-5.16/src/reopenstd.c:105: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).
	fd_old = open(rname, O_WRONLY|O_CREAT|O_APPEND, S_IWUSR|S_IRUSR|S_IRGRP);
data/watchdog-5.16/src/send-email.c:32: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 exe[512];
data/watchdog-5.16/src/send-email.c:56:4:  [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 myname[MAXHOSTNAMELEN + 1];
data/watchdog-5.16/src/shutdown.c:157: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 *mntlist[NUM_MNTLIST];
data/watchdog-5.16/src/shutdown.c:300: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).
	if ((fd = open(fname, O_WRONLY | O_APPEND)) >= 0) {
data/watchdog-5.16/src/shutdown.c:303:3:  [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(wtmp.ut_user, "shutdown");
data/watchdog-5.16/src/shutdown.c:305:3:  [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(wtmp.ut_id, "~~");
data/watchdog-5.16/src/shutdown.c:324: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[512];
data/watchdog-5.16/src/shutdown.c:327:18:  [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 ((fd_seed = open("/dev/urandom", O_RDONLY)) >= 0) {
data/watchdog-5.16/src/temp.c:100: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[128];
data/watchdog-5.16/src/temp.c:105:7:  [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).
	fp = fopen(name, "r");
data/watchdog-5.16/src/test_binary.c:23: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 proc_name[PATH_MAX];
data/watchdog-5.16/src/watchdog.c:75: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 *arg[6];
data/watchdog-5.16/src/watchdog.c:76: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 parm[22];
data/watchdog-5.16/src/watchdog.c:79: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(parm, "%d", result);
data/watchdog-5.16/src/watchdog.c:406:16:  [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).
			count_max = atol(optarg);
data/watchdog-5.16/src/wd_identify.c:78:13:  [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).
	watchdog = open(devname, O_WRONLY);
data/watchdog-5.16/src/wd_keepalive.c:123:16:  [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).
			count_max = atol(optarg);
data/watchdog-5.16/src/file_stat.c:43:4:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
			strncpy(text, ctime(&buf.st_mtime), sizeof(text)-1);
data/watchdog-5.16/src/iface.c:43:37:  [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(line + i, dev->name, strlen(dev->name)) == 0) {
data/watchdog-5.16/src/iface.c:44: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).
				unsigned long bytes = strtoul(line + i + strlen(dev->name) + 1, NULL, 10);
data/watchdog-5.16/src/killall5.c:164:11:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		nread = read(fd, buf, bsize-1);
data/watchdog-5.16/src/load.c:65:11:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	if ((n = read(load_fd, buf, sizeof(buf)-1)) < 0) {
data/watchdog-5.16/src/logmessage.c:53:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
		strncpy(progname, name, sizeof(progname) - 1);
data/watchdog-5.16/src/logmessage.c:91:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
		strncpy(err_buf, buf, sizeof(err_buf)-1);
data/watchdog-5.16/src/memory.c:59: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).
		res = atol(ptr + strlen(var));
data/watchdog-5.16/src/memory.c:123:11:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	if ((n = read(mem_fd, buf, sizeof(buf)-1)) < 0) {
data/watchdog-5.16/src/pidfile.c:36:11:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	if ((n = read(fd, buf, sizeof(buf)-1)) < 0) {
data/watchdog-5.16/src/read-conf.c:74: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).
	for (ii = strlen(buf) - 1; ii >= 0; ii--) {
data/watchdog-5.16/src/reopenstd.c:63: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).
		buf_offset = strlen(dname);
data/watchdog-5.16/src/reopenstd.c:64: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).
		buf_length = buf_offset + strlen(fnames[0]) + strlen(fsuffix[0]) + 2;
data/watchdog-5.16/src/reopenstd.c:64: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).
		buf_length = buf_offset + strlen(fnames[0]) + strlen(fsuffix[0]) + 2;
data/watchdog-5.16/src/reopenstd.c:99: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).
			assert(strlen(rname) < buf_length);
data/watchdog-5.16/src/run-as-child.c:102: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).
				opt = realloc(opt, strlen(opt) + strlen(arg[ii]) + 2);
data/watchdog-5.16/src/run-as-child.c:102: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).
				opt = realloc(opt, strlen(opt) + strlen(arg[ii]) + 2);
data/watchdog-5.16/src/run-as-child.c:103:11:  [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.
				opt = strcat(opt, " ");
data/watchdog-5.16/src/shutdown.c:138:34:  [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(mnt->mnt_dir, str, strlen(str))) {
data/watchdog-5.16/src/shutdown.c:304:3:  [1] (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 character.
		strcpy(wtmp.ut_line, "~");
data/watchdog-5.16/src/shutdown.c:326: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(seedbck) != 0) {
data/watchdog-5.16/src/shutdown.c:329:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
				if (read(fd_seed, buf, sizeof(buf)) == sizeof(buf)) {
data/watchdog-5.16/src/xmalloc.c:45:79:  [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).
		fatal_error(EX_SYSERR, "xstrdup failed for %lu byte string", (unsigned long)strlen(s));

ANALYSIS SUMMARY:

Hits = 105
Lines analyzed = 6075 in approximately 0.17 seconds (36137 lines/second)
Physical Source Lines of Code (SLOC) = 3827
Hits@level = [0]  52 [1]  23 [2]  64 [3]   3 [4]  15 [5]   0
Hits@level+ = [0+] 157 [1+] 105 [2+]  82 [3+]  18 [4+]  15 [5+]   0
Hits/KSLOC@level+ = [0+] 41.0243 [1+] 27.4366 [2+] 21.4267 [3+] 4.70342 [4+] 3.91952 [5+]   0
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.