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/fair-0.5.3/src/init.h Examining data/fair-0.5.3/src/options.h Examining data/fair-0.5.3/src/protocol.h Examining data/fair-0.5.3/src/fair.h Examining data/fair-0.5.3/src/chrono.h Examining data/fair-0.5.3/src/conf.c Examining data/fair-0.5.3/src/conf.h Examining data/fair-0.5.3/src/error.c Examining data/fair-0.5.3/src/error.h Examining data/fair-0.5.3/src/init.c Examining data/fair-0.5.3/src/address.c Examining data/fair-0.5.3/src/address.h Examining data/fair-0.5.3/src/avlr.c Examining data/fair-0.5.3/src/avlr.h Examining data/fair-0.5.3/src/carrousel.c Examining data/fair-0.5.3/src/chrono.c Examining data/fair-0.5.3/src/conn.c Examining data/fair-0.5.3/src/conn.h Examining data/fair-0.5.3/src/fd.c Examining data/fair-0.5.3/src/fd.h Examining data/fair-0.5.3/src/fdcopy.c Examining data/fair-0.5.3/src/fdcopy.h Examining data/fair-0.5.3/src/relay.c Examining data/fair-0.5.3/src/relay.h Examining data/fair-0.5.3/src/sock.c Examining data/fair-0.5.3/src/sock.h Examining data/fair-0.5.3/src/worker.c Examining data/fair-0.5.3/src/worker.h Examining data/fair-0.5.3/src/transponder.c FINAL RESULTS: data/fair-0.5.3/src/conf.c:169: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(opt->name, key); data/fair-0.5.3/src/conf.c:181: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(opt->name, key); data/fair-0.5.3/src/error.c:39: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(stderr, msg, ap); data/fair-0.5.3/src/error.c:53:6: [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. r = vfprintf(stderr, msg, ap); data/fair-0.5.3/src/error.h:30:32: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. #define syslog_exit(...) exit((syslog(__VA_ARGS__), 1)) data/fair-0.5.3/src/error.h:32: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. extern int eprintf(const char *, ...) __attribute__((format(printf, 1, 2))); data/fair-0.5.3/src/error.h:35:75: [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. extern void error_exit(const char *, ...) __attribute__((noreturn, format(printf, 1, 2))); data/fair-0.5.3/src/worker.c:208: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(wrk->name, name); data/fair-0.5.3/src/worker.c:229: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(wrk->name, name); data/fair-0.5.3/src/carrousel.c:124:15: [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, "c:")) != EOF) { data/fair-0.5.3/src/transponder.c:232:15: [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, "c:")) != EOF) { data/fair-0.5.3/src/address.c:50: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(str->host, "(null)"); data/fair-0.5.3/src/address.c:51: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(str->serv, "(null)"); data/fair-0.5.3/src/address.c:62: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(str->host, "(err)"); data/fair-0.5.3/src/address.c:63: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(str->serv, "(err)"); data/fair-0.5.3/src/address.c:71: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(str->host, "(null)"); data/fair-0.5.3/src/address.c:72: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(str->serv, "(null)"); data/fair-0.5.3/src/address.c:249:2: [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(addr+1, sa, addr->len = len); data/fair-0.5.3/src/address.c:273:2: [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(addr+1, sa, addr->len = len); data/fair-0.5.3/src/address.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 host[NI_MAXHOST]; data/fair-0.5.3/src/address.h:47: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 serv[NI_MAXSERV]; data/fair-0.5.3/src/conf.c:220: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[65536]; data/fair-0.5.3/src/conf.c:232:6: [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). f = fopen(config, "r"); data/fair-0.5.3/src/conf.h:35: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[1]; data/fair-0.5.3/src/init.c:155:6: [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). f = fopen(conf_PidFile, "w"); data/fair-0.5.3/src/transponder.c:147: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(ad+1, aip->ai_addr, ad->len = aip->ai_addrlen); data/fair-0.5.3/src/transponder.c:207: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/fair-0.5.3/src/transponder.c:266: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). procfd = open("/proc/loadavg", O_RDONLY); data/fair-0.5.3/src/worker.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 name[1]; data/fair-0.5.3/src/conf.c:166: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(key); data/fair-0.5.3/src/conf.c:178: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(key); data/fair-0.5.3/src/conf.c:212: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). end = s + strlen(s) - 1; data/fair-0.5.3/src/fdcopy.c:82:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). r = read(fd->fd, fdc->buf + end, len); data/fair-0.5.3/src/fdcopy.c:84:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). r = read(fd->fd, fdc->buf + end - size, len); data/fair-0.5.3/src/transponder.c:178:16: [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. return (void)usleep(delay); data/fair-0.5.3/src/transponder.c:196: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(delay/count); data/fair-0.5.3/src/transponder.c:217:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). r = read(procfd, buf, sizeof buf - 1); data/fair-0.5.3/src/transponder.c:263:17: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). msg->hostlen = strlen(hostname); data/fair-0.5.3/src/worker.c:205: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(name); data/fair-0.5.3/src/worker.c:225: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(name); ANALYSIS SUMMARY: Hits = 40 Lines analyzed = 3777 in approximately 0.15 seconds (25580 lines/second) Physical Source Lines of Code (SLOC) = 2509 Hits@level = [0] 42 [1] 11 [2] 18 [3] 2 [4] 9 [5] 0 Hits@level+ = [0+] 82 [1+] 40 [2+] 29 [3+] 11 [4+] 9 [5+] 0 Hits/KSLOC@level+ = [0+] 32.6823 [1+] 15.9426 [2+] 11.5584 [3+] 4.38422 [4+] 3.58709 [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.