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/tcpreen-1.4.4/logs/log.cpp Examining data/tcpreen-1.4.4/logs/basiclog.cpp Examining data/tcpreen-1.4.4/logs/passlog.h Examining data/tcpreen-1.4.4/logs/safopen.c Examining data/tcpreen-1.4.4/logs/log.h Examining data/tcpreen-1.4.4/logs/buflog.h Examining data/tcpreen-1.4.4/logs/output.c Examining data/tcpreen-1.4.4/logs/output.h Examining data/tcpreen-1.4.4/logs/secstdio.h Examining data/tcpreen-1.4.4/logs/passlog.cpp Examining data/tcpreen-1.4.4/logs/basiclog.h Examining data/tcpreen-1.4.4/logs/buflog.cpp Examining data/tcpreen-1.4.4/src/main.cpp Examining data/tcpreen-1.4.4/src/winstub.c Examining data/tcpreen-1.4.4/src/proto.cpp Examining data/tcpreen-1.4.4/src/proto.h Examining data/tcpreen-1.4.4/src/format.cpp Examining data/tcpreen-1.4.4/src/tcpreen.h Examining data/tcpreen-1.4.4/src/bridge.h Examining data/tcpreen-1.4.4/src/format.h Examining data/tcpreen-1.4.4/src/bridge.cpp Examining data/tcpreen-1.4.4/src/tcpreen.cpp Examining data/tcpreen-1.4.4/libsolve/getaddrinfo.c Examining data/tcpreen-1.4.4/libsolve/secstr.c Examining data/tcpreen-1.4.4/libsolve/sockprot.cpp Examining data/tcpreen-1.4.4/libsolve/solve.c Examining data/tcpreen-1.4.4/libsolve/secstr.h Examining data/tcpreen-1.4.4/libsolve/getaddrinfo.h Examining data/tcpreen-1.4.4/libsolve/solve.h Examining data/tcpreen-1.4.4/libsolve/sockprot.h Examining data/tcpreen-1.4.4/include/gettext.h Examining data/tcpreen-1.4.4/include/winstub.h FINAL RESULTS: data/tcpreen-1.4.4/include/winstub.h:183:7: [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. void syslog (int priority, const char *fmt, ...); data/tcpreen-1.4.4/libsolve/secstr.c:52:8: [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. res = vsnprintf (buf, len, fmt, ap); data/tcpreen-1.4.4/logs/basiclog.cpp:98:3: [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 (out, ngettext (": %ld byte sent.\n", ": %ld bytes sent.\n", data/tcpreen-1.4.4/logs/basiclog.cpp:110:3: [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 (out, ngettext (": %ld byte received.\n", data/tcpreen-1.4.4/logs/output.c:187:2: [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 (stream, ("Packet length: 0x%04x (%5d) %s\n\n"), len, len, data/tcpreen-1.4.4/src/tcpreen.cpp:78: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, fmt, ap); data/tcpreen-1.4.4/src/winstub.c:665:1: [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. syslog (int priority, const char *fmt, ... ) data/tcpreen-1.4.4/src/main.cpp:42:11: [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. # define getopt gnugetopt_broken data/tcpreen-1.4.4/src/main.cpp:45:9: [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. # undef getopt data/tcpreen-1.4.4/src/main.cpp:211:18: [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 ((check = getopt_long (argc, argv, data/tcpreen-1.4.4/src/main.cpp:399:28: [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. const char *sudo_user = getenv ("SUDO_USER"); data/tcpreen-1.4.4/src/winstub.c:529:18: [3] (misc) LoadLibrary: Ensure that the full path to the library is specified, or current directory may be used (CWE-829, CWE-20). Use registry entry or GetWindowsDirectory to find library path, if you aren't already. wship6_module = LoadLibrary ("wship6.dll"); data/tcpreen-1.4.4/src/winstub.c:556:18: [3] (misc) LoadLibrary: Ensure that the full path to the library is specified, or current directory may be used (CWE-829, CWE-20). Use registry entry or GetWindowsDirectory to find library path, if you aren't already. wship6_module = LoadLibrary ("wship6.dll"); data/tcpreen-1.4.4/src/winstub.c:591:18: [3] (misc) LoadLibrary: Ensure that the full path to the library is specified, or current directory may be used (CWE-829, CWE-20). Use registry entry or GetWindowsDirectory to find library path, if you aren't already. wship6_module = LoadLibrary ("wship6.dll"); data/tcpreen-1.4.4/include/gettext.h:201: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 msg_ctxt_id[msgctxt_len + msgid_len]; data/tcpreen-1.4.4/include/gettext.h:203: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 buf[1024]; data/tcpreen-1.4.4/include/gettext.h:211:7: [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 (msg_ctxt_id, msgctxt, msgctxt_len - 1); data/tcpreen-1.4.4/include/gettext.h:213:7: [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 (msg_ctxt_id + msgctxt_len, msgid, msgid_len); data/tcpreen-1.4.4/include/gettext.h:247: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 msg_ctxt_id[msgctxt_len + msgid_len]; data/tcpreen-1.4.4/include/gettext.h:249: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 buf[1024]; data/tcpreen-1.4.4/include/gettext.h:257:7: [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 (msg_ctxt_id, msgctxt, msgctxt_len - 1); data/tcpreen-1.4.4/include/gettext.h:259:7: [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 (msg_ctxt_id + msgctxt_len, msgid, msgid_len); data/tcpreen-1.4.4/libsolve/getaddrinfo.c:272: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 (res->ai_addr, addr, addrlen); data/tcpreen-1.4.4/libsolve/sockprot.h:41: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 myhost[1024], myserv[128]; data/tcpreen-1.4.4/libsolve/solve.c:53: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 n1[NI_MAXHOST], n2[NI_MAXHOST]; data/tcpreen-1.4.4/libsolve/solve.c:160: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, addr, addrlen); data/tcpreen-1.4.4/libsolve/solve.c:179: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 (res, src, sizeof (struct addrinfo)); data/tcpreen-1.4.4/libsolve/solve.c:206: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 (res->ai_addr, src->ai_addr, src->ai_addrlen); data/tcpreen-1.4.4/libsolve/solve.c:293: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 (&inet_hints, hints, data/tcpreen-1.4.4/logs/buflog.cpp:48:20: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char c = ((const char *)data)[i]; data/tcpreen-1.4.4/logs/output.c:86:33: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. if (fputc_C (((const unsigned char *)buf)[i], stream) == EOF) data/tcpreen-1.4.4/logs/output.c:111:24: [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. c = ((const unsigned char *)buf)[i]; data/tcpreen-1.4.4/logs/output.c:157:37: [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. if ((fputc_hex (((const unsigned char *)buf)[j], data/tcpreen-1.4.4/logs/output.c:177:38: [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. if (fputc_strip (((const unsigned char *)buf)[i], data/tcpreen-1.4.4/logs/passlog.cpp:116:12: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char in[4]; data/tcpreen-1.4.4/logs/passlog.cpp:223:13: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char buf_enc[345]; data/tcpreen-1.4.4/logs/passlog.cpp:224: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 buf_dec[256]; data/tcpreen-1.4.4/logs/passlog.h:37: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 username[PASSLOG_MAXUSER], password[PASSLOG_MAXPASS], data/tcpreen-1.4.4/logs/safopen.c:39:9: [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). return fopen (path, mode); data/tcpreen-1.4.4/logs/safopen.c:185: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 (path, flags | O_LARGEFILE, 0666); data/tcpreen-1.4.4/src/bridge.cpp: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 buffer[BRIDGE_BUFFER_SIZE]; data/tcpreen-1.4.4/src/proto.cpp:104: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 name[MAX_PROTONAME]; data/tcpreen-1.4.4/src/proto.cpp:106: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 (name, parm, len); data/tcpreen-1.4.4/src/winstub.c:108: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 buf[32]; data/tcpreen-1.4.4/include/gettext.h:197: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). size_t msgctxt_len = strlen (msgctxt) + 1; data/tcpreen-1.4.4/include/gettext.h:198:22: [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). size_t msgid_len = strlen (msgid) + 1; data/tcpreen-1.4.4/include/gettext.h:243: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). size_t msgctxt_len = strlen (msgctxt) + 1; data/tcpreen-1.4.4/include/gettext.h:244:22: [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). size_t msgid_len = strlen (msgid) + 1; data/tcpreen-1.4.4/include/winstub.h:77:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). # define read winsock_read data/tcpreen-1.4.4/libsolve/secstr.c:37:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (dest, src, n); data/tcpreen-1.4.4/libsolve/sockprot.cpp:90:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (myhost, host, sizeof (myhost)); data/tcpreen-1.4.4/libsolve/solve.c:231:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (addr.sun_path, path, sizeof (addr.sun_path)); data/tcpreen-1.4.4/logs/log.cpp:276: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 len = strlen (prefix) + strlen (addr) data/tcpreen-1.4.4/logs/log.cpp:276: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). int len = strlen (prefix) + strlen (addr) data/tcpreen-1.4.4/logs/log.cpp:277:9: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). + strlen (port) + 3; data/tcpreen-1.4.4/logs/passlog.cpp:200:4: [1] (buffer) sscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. sscanf (data, "%*s %127s", username); data/tcpreen-1.4.4/logs/passlog.cpp:204:9: [1] (buffer) sscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. if ((sscanf (data, "%*s %127s", password) == 1) data/tcpreen-1.4.4/logs/passlog.cpp:213:8: [1] (buffer) sscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. if (sscanf (data, "%*s %127s %127s", username, data/tcpreen-1.4.4/logs/passlog.cpp:226:8: [1] (buffer) sscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. if (sscanf (data, "%*s Basic %511s\n", buf_enc) == 1) ANALYSIS SUMMARY: Hits = 59 Lines analyzed = 6027 in approximately 0.17 seconds (35806 lines/second) Physical Source Lines of Code (SLOC) = 4012 Hits@level = [0] 26 [1] 15 [2] 30 [3] 7 [4] 7 [5] 0 Hits@level+ = [0+] 85 [1+] 59 [2+] 44 [3+] 14 [4+] 7 [5+] 0 Hits/KSLOC@level+ = [0+] 21.1864 [1+] 14.7059 [2+] 10.9671 [3+] 3.48953 [4+] 1.74477 [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.