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/thinkfan-0.9.3/src/config.c
Examining data/thinkfan-0.9.3/src/config.h
Examining data/thinkfan-0.9.3/src/globaldefs.h
Examining data/thinkfan-0.9.3/src/message.c
Examining data/thinkfan-0.9.3/src/message.h
Examining data/thinkfan-0.9.3/src/parser.c
Examining data/thinkfan-0.9.3/src/parser.h
Examining data/thinkfan-0.9.3/src/system.c
Examining data/thinkfan-0.9.3/src/system.h
Examining data/thinkfan-0.9.3/src/thinkfan.c
Examining data/thinkfan-0.9.3/src/thinkfan.h

FINAL RESULTS:

data/thinkfan-0.9.3/src/config.c:204: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(cfg_local->fan, IBM_FAN);
data/thinkfan-0.9.3/src/config.c:236: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(default_sensor->path, IBM_TEMP);
data/thinkfan-0.9.3/src/message.c:34: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(stderr, format, ap);
data/thinkfan-0.9.3/src/message.c:60:3:  [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).
		strcat(rv, tmp);
data/thinkfan-0.9.3/src/system.c:302: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(fan_enable, config->fan);
data/thinkfan-0.9.3/src/system.c:332: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(fan_enable, config->fan);
data/thinkfan-0.9.3/src/system.c:361: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(fan_enable, config->fan);
data/thinkfan-0.9.3/src/thinkfan.c:252:4:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
			fprintf(stderr, MSG_USAGE);
data/thinkfan-0.9.3/src/thinkfan.c:316:4:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
			fprintf(stderr, MSG_USAGE);
data/thinkfan-0.9.3/src/thinkfan.c:249:16:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
	while ((opt = getopt(argc, argv, optstring)) != -1) {
data/thinkfan-0.9.3/src/config.c:62: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/thinkfan-0.9.3/src/message.c:47:2:  [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(rv, "current temperatures: (");
data/thinkfan-0.9.3/src/system.c:52:29:  [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 (unlikely(((ibm_temp = open( \
data/thinkfan-0.9.3/src/system.c:124: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).
	if (unlikely((ibm_fan = open(IBM_FAN, O_RDWR, O_TRUNC)) < 0)) {
data/thinkfan-0.9.3/src/system.c:149: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 ((ibm_fan = fopen(IBM_FAN, "r+")) == NULL) {
data/thinkfan-0.9.3/src/system.c:174: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).
	if ((fan = fopen(IBM_FAN, "r+")) == NULL) {
data/thinkfan-0.9.3/src/system.c:191: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).
	if (unlikely((ibm_fan = open(IBM_FAN, O_RDWR)) < 0)) {
data/thinkfan-0.9.3/src/system.c:227: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[8];
data/thinkfan-0.9.3/src/system.c:230:21:  [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 (unlikely((fd = open(config->sensors[sensoridx].path, O_RDONLY)) == -1
data/thinkfan-0.9.3/src/system.c:262: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).
	if (unlikely((fan = open(config->fan, O_WRONLY)) < 0)) {
data/thinkfan-0.9.3/src/system.c:303:2:  [2] (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 string.
	strcat(fan_enable, "_enable");
data/thinkfan-0.9.3/src/system.c:305: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).
	if ((fan = fopen(fan_enable, "r")) == NULL) {
data/thinkfan-0.9.3/src/system.c:333:2:  [2] (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 string.
	strcat(fan_enable, "_enable");
data/thinkfan-0.9.3/src/system.c:335: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(fan_enable, O_WRONLY)) < 0) {
data/thinkfan-0.9.3/src/system.c:362:2:  [2] (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 string.
	strcat(fan_enable, "_enable");
data/thinkfan-0.9.3/src/system.c:365:14:  [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 ((fan = fopen(fan_enable, "r+")) == NULL) {
data/thinkfan-0.9.3/src/thinkfan.c:361:32:  [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 (chk_sanity && ((pidfile = fopen(PID_FILE, "r")) != NULL)) {
data/thinkfan-0.9.3/src/thinkfan.c:393: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 ((pidfile = fopen(PID_FILE, "w+")) == NULL && chk_sanity) {
data/thinkfan-0.9.3/src/config.c:203:36:  [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).
		cfg_local->fan = (char *) calloc(strlen(IBM_FAN)+1, sizeof(char));
data/thinkfan-0.9.3/src/config.c:220: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).
				char *conv_lvl = calloc(7 + strlen(cfg_local->limits[i].level), sizeof(char));
data/thinkfan-0.9.3/src/config.c:221: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).
				snprintf(conv_lvl, 7 + strlen(cfg_local->limits[i].level),
data/thinkfan-0.9.3/src/config.c:235:42:  [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).
		default_sensor->path = (char *) calloc(strlen(IBM_TEMP) + 1, sizeof(char));
data/thinkfan-0.9.3/src/message.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).
		rv = realloc(rv, strlen(rv) + len + 1);
data/thinkfan-0.9.3/src/message.c:63:5:  [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).
	rv[strlen(rv) - 2] = ')';
data/thinkfan-0.9.3/src/message.c:64:5:  [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).
	rv[strlen(rv) - 1] = '\0';
data/thinkfan-0.9.3/src/parser.c:95:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
		strncpy(ret, start, *input - start);
data/thinkfan-0.9.3/src/parser.c:121:10:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
	int l = strlen(keyword);
data/thinkfan-0.9.3/src/parser.c:337:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
		strncpy(line, start, strchr(start, '\n') - start);
data/thinkfan-0.9.3/src/system.c:54:14:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
				|| ((r = read(ibm_temp, rbuf, 128)) < 14) \
data/thinkfan-0.9.3/src/system.c:122: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).
	int ibm_fan, l = strlen(cur_lvl);
data/thinkfan-0.9.3/src/system.c:205:6:  [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.
	if (usleep(depulse)) {
data/thinkfan-0.9.3/src/system.c:231:14:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			|| (num = read(fd, &buf, 7)) == -1
data/thinkfan-0.9.3/src/system.c:260:15:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
	int fan, l = strlen(cur_lvl);
data/thinkfan-0.9.3/src/system.c:297: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 *fan_enable = (char *) malloc((strlen(config->fan) + 8) * sizeof(char));
data/thinkfan-0.9.3/src/system.c:329: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 *fan_enable = (char *) malloc((strlen(config->fan) + 8) * sizeof(char));
data/thinkfan-0.9.3/src/system.c:359: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 *fan_enable = (char *) malloc((strlen(config->fan) + 8) * sizeof(char));

ANALYSIS SUMMARY:

Hits = 46
Lines analyzed = 2210 in approximately 0.09 seconds (24766 lines/second)
Physical Source Lines of Code (SLOC) = 1626
Hits@level = [0]   9 [1]  18 [2]  18 [3]   1 [4]   9 [5]   0
Hits@level+ = [0+]  55 [1+]  46 [2+]  28 [3+]  10 [4+]   9 [5+]   0
Hits/KSLOC@level+ = [0+] 33.8253 [1+] 28.2903 [2+] 17.2202 [3+] 6.15006 [4+] 5.53506 [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.