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/spacenavd-0.7.1/src/dev_usb.c
Examining data/spacenavd-0.7.1/src/dev_usb.h
Examining data/spacenavd-0.7.1/src/dev.c
Examining data/spacenavd-0.7.1/src/xdetect.h
Examining data/spacenavd-0.7.1/src/magellan/smag_event.c
Examining data/spacenavd-0.7.1/src/magellan/smag_comm.c
Examining data/spacenavd-0.7.1/src/magellan/smag_event.h
Examining data/spacenavd-0.7.1/src/magellan/serialconstants.h
Examining data/spacenavd-0.7.1/src/magellan/smag_detect.c
Examining data/spacenavd-0.7.1/src/magellan/smag.c
Examining data/spacenavd-0.7.1/src/magellan/smag_comm.h
Examining data/spacenavd-0.7.1/src/magellan/smag.h
Examining data/spacenavd-0.7.1/src/magellan/smag_detect.h
Examining data/spacenavd-0.7.1/src/event.c
Examining data/spacenavd-0.7.1/src/cfgfile.c
Examining data/spacenavd-0.7.1/src/xdetect_freebsd.c
Examining data/spacenavd-0.7.1/src/spnavd.c
Examining data/spacenavd-0.7.1/src/serial/sballserial.h
Examining data/spacenavd-0.7.1/src/serial/sball.c
Examining data/spacenavd-0.7.1/src/serial/sball.h
Examining data/spacenavd-0.7.1/src/serial/sballserial.c
Examining data/spacenavd-0.7.1/src/dev_serial.c
Examining data/spacenavd-0.7.1/src/spnavd_win32.c
Examining data/spacenavd-0.7.1/src/hotplug.h
Examining data/spacenavd-0.7.1/src/logger.c
Examining data/spacenavd-0.7.1/src/kbemu.h
Examining data/spacenavd-0.7.1/src/xdetect_linux.c
Examining data/spacenavd-0.7.1/src/proto_x11.h
Examining data/spacenavd-0.7.1/src/hotplug_darwin.c
Examining data/spacenavd-0.7.1/src/dev_usb_linux.c
Examining data/spacenavd-0.7.1/src/dev_usb_darwin.c
Examining data/spacenavd-0.7.1/src/dummy_usb.c
Examining data/spacenavd-0.7.1/src/cfgfile.h
Examining data/spacenavd-0.7.1/src/dev.h
Examining data/spacenavd-0.7.1/src/client.c
Examining data/spacenavd-0.7.1/src/dev_serial.h
Examining data/spacenavd-0.7.1/src/proto_unix.c
Examining data/spacenavd-0.7.1/src/kbemu.c
Examining data/spacenavd-0.7.1/src/proto_x11.c
Examining data/spacenavd-0.7.1/src/event.h
Examining data/spacenavd-0.7.1/src/proto_unix.h
Examining data/spacenavd-0.7.1/src/hotplug_linux.c
Examining data/spacenavd-0.7.1/src/client.h
Examining data/spacenavd-0.7.1/src/logger.h
Examining data/spacenavd-0.7.1/src/spnavd.h

FINAL RESULTS:

data/spacenavd-0.7.1/src/dev.c:46:4:  [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(dev->path, cfg.serial_dev);
data/spacenavd-0.7.1/src/dev.c:71:4:  [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(dev->path, usbdev->devfiles[i]);
data/spacenavd-0.7.1/src/dev_usb.c:58:7:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
	s += sprintf(s, "[%x:%x]: \"%s\" (", devinfo->vendorid, devinfo->productid,
data/spacenavd-0.7.1/src/dev_usb.c:61:8:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
		s += sprintf(s, "%s ", devinfo->devfiles[i]);
data/spacenavd-0.7.1/src/dev_usb_linux.c:396:8:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
							sprintf(devinfo.devfiles[idx++], "%s%s", prefix, devfile);
data/spacenavd-0.7.1/src/dev_usb_linux.c:472:3:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
		sprintf(devinfo.devfiles[0], "/dev/input/%s", dent->d_name);
data/spacenavd-0.7.1/src/logger.c:49:3:  [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(logfile, fmt, ap);
data/spacenavd-0.7.1/src/magellan/smag.c:185: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(buf, tmpbuf);
data/spacenavd-0.7.1/src/magellan/smag.c:370: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(old_state, input.packet_buf);
data/spacenavd-0.7.1/src/proto_unix.c:56: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(addr.sun_path, SOCK_NAME);
data/spacenavd-0.7.1/src/proto_x11.c:109:3:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
		sprintf(buf, "XAUTHORITY=%s/.Xauthority", home);
data/spacenavd-0.7.1/src/spnavd.c:447:2:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
	sprintf(buf + strlen(buf), "/%s", str);
data/spacenavd-0.7.1/src/proto_x11.c:87: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("DISPLAY")) {
data/spacenavd-0.7.1/src/proto_x11.c:92: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("XAUTHORITY")) {
data/spacenavd-0.7.1/src/proto_x11.c:100: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(!(home = getenv("HOME"))) {
data/spacenavd-0.7.1/src/proto_x11.c:114:59:  [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.
		logmsg(LOG_INFO, "trying to open X11 display \"%s\"\n", getenv("DISPLAY"));
data/spacenavd-0.7.1/src/proto_x11.c:115:42:  [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.
		logmsg(LOG_INFO, "   XAUTHORITY=%s\n", getenv("XAUTHORITY"));
data/spacenavd-0.7.1/src/proto_x11.c:119:58:  [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.
		logmsg(LOG_ERR, "failed to open X11 display \"%s\"\n", getenv("DISPLAY"));
data/spacenavd-0.7.1/src/proto_x11.c:189:67:  [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.
			logmsg(LOG_INFO, "closing X11 connection to display \"%s\"\n", getenv("DISPLAY"));
data/spacenavd-0.7.1/src/xdetect_linux.c:126:17:  [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((dpystr = getenv("DISPLAY"))) {
data/spacenavd-0.7.1/src/cfgfile.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[512];
data/spacenavd-0.7.1/src/cfgfile.c:90: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(!(fp = fopen(fname, "r"))) {
data/spacenavd-0.7.1/src/cfgfile.c:337: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(!(fp = fopen(fname, "w"))) {
data/spacenavd-0.7.1/src/cfgfile.h:41: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 *kbmap_str[MAX_BUTTONS];
data/spacenavd-0.7.1/src/cfgfile.h:43: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 serial_dev[PATH_MAX];
data/spacenavd-0.7.1/src/cfgfile.h: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 *devname[MAX_CUSTOM];	/* custom USB device name list */
data/spacenavd-0.7.1/src/dev.c:50:5:  [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(dev->name, "serial device");
data/spacenavd-0.7.1/src/dev.h:31: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 name[MAX_DEV_NAME];
data/spacenavd-0.7.1/src/dev.h: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 path[PATH_MAX];
data/spacenavd-0.7.1/src/dev_usb.c:63: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(s, ")\n");
data/spacenavd-0.7.1/src/dev_usb.h:30: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 *devfiles[MAX_USB_DEV_FILES];
data/spacenavd-0.7.1/src/dev_usb_darwin.c:40:9:  [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 dev_path[512];
data/spacenavd-0.7.1/src/dev_usb_linux.c:70: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 evtype_mask[((EV_MAX | KEY_MAX) + 7) / 8];
data/spacenavd-0.7.1/src/dev_usb_linux.c:72: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((dev->fd = open(dev->path, O_RDWR)) == -1) {
data/spacenavd-0.7.1/src/dev_usb_linux.c:73: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).
		if((dev->fd = open(dev->path, O_RDONLY)) == -1) {
data/spacenavd-0.7.1/src/dev_usb_linux.c:82: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(dev->name, "unknown");
data/spacenavd-0.7.1/src/dev_usb_linux.c:298: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/spacenavd-0.7.1/src/dev_usb_linux.c:312: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(!(fp = fopen(PROC_DEV, "r"))) {
data/spacenavd-0.7.1/src/dev_usb_linux.c:484: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(devinfo.devfiles[0], O_RDONLY)) == -1) {
data/spacenavd-0.7.1/src/hotplug_linux.c:93: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/spacenavd-0.7.1/src/logger.c:28:17:  [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(!(logfile = fopen(fname, "w"))) {
data/spacenavd-0.7.1/src/magellan/smag.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 rbuf[MAXREADSIZE];
data/spacenavd-0.7.1/src/magellan/smag.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 packet_buf[MAXPACKETSIZE];
data/spacenavd-0.7.1/src/magellan/smag.c:169: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 tmpbuf[MAXREADSIZE];
data/spacenavd-0.7.1/src/magellan/smag.c:321:9:  [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 old_state[5] = { 0, 0, 0, 0, 0 };
data/spacenavd-0.7.1/src/magellan/smag_comm.c:35: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).
	return open(fname, O_RDWR | O_NOCTTY | O_NONBLOCK | O_NDELAY);
data/spacenavd-0.7.1/src/magellan/smag_detect.c:42: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 tmpbuf[MAXREADSIZE];
data/spacenavd-0.7.1/src/proto_x11.c:397: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/spacenavd-0.7.1/src/serial/sball.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 buf[256];
data/spacenavd-0.7.1/src/serial/sball.c:72: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 resetstring[256];
data/spacenavd-0.7.1/src/serial/sball.c:176: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 rawbuf[1024];
data/spacenavd-0.7.1/src/serial/sball.c:519: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 outbuf[200];
data/spacenavd-0.7.1/src/serial/sball.c:524: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(outbuf, "\rZ\r");
data/spacenavd-0.7.1/src/serial/sballserial.c:72: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).
	comm->fd = open(commname, O_RDWR | O_NONBLOCK | O_NOCTTY);
data/spacenavd-0.7.1/src/spnavd.c:263:2:  [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).
	open("/dev/zero", O_RDONLY);
data/spacenavd-0.7.1/src/spnavd.c:289: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(!(fp = fopen(PIDFILE, "w"))) {
data/spacenavd-0.7.1/src/spnavd.c:304: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(!(fp = fopen(PIDFILE, "r"))) {
data/spacenavd-0.7.1/src/xdetect_freebsd.c:48:15:  [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_x11 = open("/tmp/.X11-unix", O_RDONLY)) == -1) {
data/spacenavd-0.7.1/src/xdetect_freebsd.c:49: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((fd_tmp = open("/tmp", O_RDONLY)) == -1) {
data/spacenavd-0.7.1/src/xdetect_freebsd.c:117: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((fd_x11 = open("/tmp/.X11-unix", O_RDONLY)) == -1) {
data/spacenavd-0.7.1/src/xdetect_linux.c:85: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/spacenavd-0.7.1/src/xdetect_linux.c:123: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 *dpystr, sock_file[64];
data/spacenavd-0.7.1/src/xdetect_linux.c:129:15:  [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).
					dpynum = atoi(tmp + 1);
data/spacenavd-0.7.1/src/xdetect_linux.c:132: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(sock_file, "X%d", dpynum);
data/spacenavd-0.7.1/src/cfgfile.c:303:4:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
			strncpy(cfg->serial_dev, val_str, PATH_MAX - 1);
data/spacenavd-0.7.1/src/dev.c:178:14:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	return dev->read(dev, inp);
data/spacenavd-0.7.1/src/dev.h:39:8:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	int (*read)(struct device*, struct dev_input*);
data/spacenavd-0.7.1/src/dev_usb.c:52:8:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
	sz += strlen(devname);
data/spacenavd-0.7.1/src/dev_usb.c:54: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).
		sz += strlen(devinfo->devfiles[i]) + 1;
data/spacenavd-0.7.1/src/dev_usb_linux.c:224:13:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		rdbytes = read(dev->fd, &iev, sizeof iev);
data/spacenavd-0.7.1/src/dev_usb_linux.c:330: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_used = strlen(section_start);
data/spacenavd-0.7.1/src/dev_usb_linux.c:355: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).
						char *endp, *valptr = keyptr + strlen("Vendor=");
data/spacenavd-0.7.1/src/dev_usb_linux.c:360: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).
						char *endp, *valptr = keyptr + strlen("Product=");
data/spacenavd-0.7.1/src/dev_usb_linux.c:368:31:  [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).
						char *valptr = keyptr + strlen("Name=\"");
data/spacenavd-0.7.1/src/dev_usb_linux.c:382:45:  [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).
						char *devfile = 0, *valptr = keyptr + strlen("Handlers=");
data/spacenavd-0.7.1/src/dev_usb_linux.c:392: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).
							if(!(devinfo.devfiles[idx] = malloc(strlen(devfile) + strlen(prefix) + 1))) {
data/spacenavd-0.7.1/src/dev_usb_linux.c:392:62:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
							if(!(devinfo.devfiles[idx] = malloc(strlen(devfile) + strlen(prefix) + 1))) {
data/spacenavd-0.7.1/src/dev_usb_linux.c:468: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(!(devinfo.devfiles[0] = malloc(strlen(dent->d_name) + strlen("/dev/input/") + 1))) {
data/spacenavd-0.7.1/src/dev_usb_linux.c:468: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(!(devinfo.devfiles[0] = malloc(strlen(dent->d_name) + strlen("/dev/input/") + 1))) {
data/spacenavd-0.7.1/src/hotplug_linux.c:94:2:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	read(hotplug_fd, buf, sizeof buf);
data/spacenavd-0.7.1/src/magellan/smag.c:85:2:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
	usleep(SMAG_DELAY_USEC);
data/spacenavd-0.7.1/src/magellan/smag.c:178:2:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
	usleep(SMAG_DELAY_USEC);
data/spacenavd-0.7.1/src/magellan/smag_comm.c:120:3:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
		usleep(SMAG_DELAY_USEC);
data/spacenavd-0.7.1/src/magellan/smag_comm.c:123:2:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
	usleep(LONG_DELAY);
data/spacenavd-0.7.1/src/magellan/smag_comm.c:128:16:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	int bytesrd = read(fd, buf, sz - 1);
data/spacenavd-0.7.1/src/magellan/smag_detect.c:78:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
		strncpy(buf, tmpbuf, sz);
data/spacenavd-0.7.1/src/magellan/smag_detect.c:101:2:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
	strncpy(buf, tmpbuf, sz);
data/spacenavd-0.7.1/src/proto_unix.c:58:15:  [1] (access) umask:
  Ensure that umask is given most restrictive possible setting (e.g., 066 or
  077) (CWE-732).
	prev_umask = umask(0);
data/spacenavd-0.7.1/src/proto_unix.c:66:2:  [1] (access) umask:
  Ensure that umask is given most restrictive possible setting (e.g., 066 or
  077) (CWE-732).
	umask(prev_umask);
data/spacenavd-0.7.1/src/proto_unix.c:162:22:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
				while((rdbytes = read(s, &sens, sizeof sens)) <= 0 && errno == EINTR);
data/spacenavd-0.7.1/src/proto_x11.c:108: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 = alloca(strlen("XAUTHORITY=") + strlen(home) + strlen("/.Xauthority") + 1);
data/spacenavd-0.7.1/src/proto_x11.c:108:40:  [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 = alloca(strlen("XAUTHORITY=") + strlen(home) + strlen("/.Xauthority") + 1);
data/spacenavd-0.7.1/src/proto_x11.c:108:55:  [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 = alloca(strlen("XAUTHORITY=") + strlen(home) + strlen("/.Xauthority") + 1);
data/spacenavd-0.7.1/src/serial/sball.c:542:2:  [1] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source is a constant character.
	sprintf(outbuf, "\r");
data/spacenavd-0.7.1/src/serial/sballserial.c:119: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).
	return write(comm->fd, buf, strlen(buf));
data/spacenavd-0.7.1/src/serial/sballserial.c:129:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	return read(comm->fd, buf, sz);
data/spacenavd-0.7.1/src/spnavd.c:319:2:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
	strncpy(addr.sun_path, SOCK_NAME, sizeof addr.sun_path);
data/spacenavd-0.7.1/src/spnavd.c:423:8:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
	len = strlen(str) + 1;	/* +1 for the path separator */
data/spacenavd-0.7.1/src/spnavd.c:447: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).
	sprintf(buf + strlen(buf), "/%s", str);
data/spacenavd-0.7.1/src/xdetect_linux.c:94:13:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		if((res = read(fd, buf, sizeof buf)) <= 0) {

ANALYSIS SUMMARY:

Hits = 100
Lines analyzed = 6351 in approximately 0.19 seconds (32764 lines/second)
Physical Source Lines of Code (SLOC) = 4169
Hits@level = [0] 112 [1]  36 [2]  44 [3]   8 [4]  12 [5]   0
Hits@level+ = [0+] 212 [1+] 100 [2+]  64 [3+]  20 [4+]  12 [5+]   0
Hits/KSLOC@level+ = [0+] 50.8515 [1+] 23.9866 [2+] 15.3514 [3+] 4.79731 [4+] 2.87839 [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.