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/portsentry-1.2/portsentry.h Examining data/portsentry-1.2/portsentry_io.c Examining data/portsentry-1.2/portsentry_io.h Examining data/portsentry-1.2/portsentry_util.c Examining data/portsentry-1.2/portsentry_util.h Examining data/portsentry-1.2/portsentry_tcpip.h Examining data/portsentry-1.2/portsentry_config.h Examining data/portsentry-1.2/portsentry.c FINAL RESULTS: data/portsentry-1.2/portsentry_io.c:33:3: [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 (logbuffer, MAXBUF, logentry, argsPtr); data/portsentry-1.2/portsentry_io.c:507:16: [4] (shell) system: 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. killStatus = system (commandStringFinal); data/portsentry-1.2/portsentry_io.c:562:16: [4] (shell) system: 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. killStatus = system (commandStringFinal); data/portsentry-1.2/portsentry_io.c:798:1: [4] (format) snprintf: 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. snprintf (char *str, size_t n, char const *fmt,...) data/portsentry-1.2/portsentry_io.c:812:10: [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. (void) vfprintf (&f, fmt, ap); data/portsentry-1.2/portsentry.c:25:1: [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 gblScanDetectHost[MAXSTATE][IPMAXBUF]; data/portsentry-1.2/portsentry.c:26:1: [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 gblKillRoute[MAXBUF]; data/portsentry-1.2/portsentry.c:27:1: [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 gblKillHostsDeny[MAXBUF]; data/portsentry-1.2/portsentry.c:28:1: [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 gblKillRunCmd[MAXBUF]; data/portsentry-1.2/portsentry.c:29:1: [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 gblBlockedFile[MAXBUF]; data/portsentry-1.2/portsentry.c:30:1: [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 gblHistoryFile[MAXBUF]; data/portsentry-1.2/portsentry.c:31:1: [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 gblIgnoreFile[MAXBUF]; data/portsentry-1.2/portsentry.c:32:1: [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 gblDetectionType[MAXBUF]; data/portsentry-1.2/portsentry.c:167: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 configToken[MAXBUF]; data/portsentry-1.2/portsentry.c:188:31: [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). gblConfigTriggerCount = atoi (configToken); data/portsentry-1.2/portsentry.c:256:20: [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 ((input = fopen (gblBlockedFile, "w")) == NULL) data/portsentry-1.2/portsentry.c:310: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 packetBuffer[TCPPACKETLEN]; data/portsentry-1.2/portsentry.c:319: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 (ipPtr, (struct iphdr *) packetBuffer, sizeof (struct iphdr)); data/portsentry-1.2/portsentry.c:330: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 (tcpPtr, (struct tcphdr *) (packetBuffer + ((ipPtr->ihl) * 4)), data/portsentry-1.2/portsentry.c:342: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 packetBuffer[UDPPACKETLEN]; data/portsentry-1.2/portsentry.c:351: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 (ipPtr, (struct iphdr *) packetBuffer, sizeof (struct iphdr)); data/portsentry-1.2/portsentry.c:362: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 (udpPtr, (struct udphdr *) (packetBuffer + ((ipPtr->ihl) * 4)), data/portsentry-1.2/portsentry.c:383: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 *temp, target[IPMAXBUF], configToken[MAXBUF]; data/portsentry-1.2/portsentry.c:384: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 resolvedHost[DNSMAXBUF], *packetType; data/portsentry-1.2/portsentry.c:398: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). ports[0] = atoi (temp); data/portsentry-1.2/portsentry.c:402:21: [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). ports[count] = atoi (temp); data/portsentry-1.2/portsentry.c:558: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 target[IPMAXBUF], configToken[MAXBUF]; data/portsentry-1.2/portsentry.c:559: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 resolvedHost[DNSMAXBUF], *temp, *packetType; data/portsentry-1.2/portsentry.c:570:21: [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). advancedPorts = atoi (configToken); data/portsentry-1.2/portsentry.c:594:30: [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). inUsePorts[portCount++] = atoi (temp); data/portsentry-1.2/portsentry.c:601:31: [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). inUsePorts[portCount++] = atoi (temp); data/portsentry-1.2/portsentry.c:739: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 *temp, target[IPMAXBUF], configToken[MAXBUF]; data/portsentry-1.2/portsentry.c:740: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 resolvedHost[DNSMAXBUF]; data/portsentry-1.2/portsentry.c:755: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). ports[0] = atoi (temp); data/portsentry-1.2/portsentry.c:759:21: [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). ports[count] = atoi (temp); data/portsentry-1.2/portsentry.c:904: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 target[IPMAXBUF], configToken[MAXBUF]; data/portsentry-1.2/portsentry.c:905: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 resolvedHost[DNSMAXBUF], *temp; data/portsentry-1.2/portsentry.c:917:21: [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). advancedPorts = atoi (configToken); data/portsentry-1.2/portsentry.c:941:30: [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). inUsePorts[portCount++] = atoi (temp); data/portsentry-1.2/portsentry.c:948:31: [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). inUsePorts[portCount++] = atoi (temp); data/portsentry-1.2/portsentry.c:1084: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 *temp, target[IPMAXBUF], bannerBuffer[MAXBUF], configToken[MAXBUF]; data/portsentry-1.2/portsentry.c:1085: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 resolvedHost[DNSMAXBUF]; data/portsentry-1.2/portsentry.c:1097: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). ports[0] = atoi (temp); data/portsentry-1.2/portsentry.c:1101:21: [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). ports[count] = atoi (temp); data/portsentry-1.2/portsentry.c:1283: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 *temp, target[IPMAXBUF], bannerBuffer[MAXBUF], configToken[MAXBUF]; data/portsentry-1.2/portsentry.c:1284: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 buffer[MAXBUF]; data/portsentry-1.2/portsentry.c:1285: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 resolvedHost[DNSMAXBUF]; data/portsentry-1.2/portsentry.c:1297: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). ports[0] = atoi (temp); data/portsentry-1.2/portsentry.c:1301:21: [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). ports[count] = atoi (temp); data/portsentry-1.2/portsentry.c:1690:10: [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 packetDesc[MAXBUF]; data/portsentry-1.2/portsentry_io.c:28: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 logbuffer[MAXBUF]; data/portsentry-1.2/portsentry_io.c:132: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 buffer[MAXBUF], tempBuffer[MAXBUF], netmaskBuffer[MAXBUF]; data/portsentry-1.2/portsentry_io.c:139:16: [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 ((input = fopen (filename, "r")) == NULL) data/portsentry-1.2/portsentry_io.c:183:16: [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). netmaskBits = atoi(netmaskBuffer); data/portsentry-1.2/portsentry_io.c:217:16: [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 ((input = fopen (CONFIG_FILE, "r")) == NULL) data/portsentry-1.2/portsentry_io.c:250:21: [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 ((output = fopen (blockedFilename, "a")) == NULL) data/portsentry-1.2/portsentry_io.c:268:21: [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 ((output = fopen (historyFilename, "a")) == NULL) data/portsentry-1.2/portsentry_io.c:298: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 buffer[MAXBUF], tokenBuffer[MAXBUF]; data/portsentry-1.2/portsentry_io.c:301: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 ((config = fopen (CONFIG_FILE, "r")) == NULL) data/portsentry-1.2/portsentry_io.c:469: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 cleanAddr[MAXBUF], commandStringTemp[MAXBUF]; data/portsentry-1.2/portsentry_io.c:470: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 commandStringTemp2[MAXBUF],commandStringFinal[MAXBUF]; data/portsentry-1.2/portsentry_io.c:471: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 portString[MAXBUF]; data/portsentry-1.2/portsentry_io.c:533: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 cleanAddr[MAXBUF], commandStringTemp[MAXBUF]; data/portsentry-1.2/portsentry_io.c:534: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 commandStringTemp2[MAXBUF], commandStringFinal[MAXBUF]; data/portsentry-1.2/portsentry_io.c:535: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 portString[MAXBUF]; data/portsentry-1.2/portsentry_io.c:592: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 cleanAddr[MAXBUF], commandStringTemp[MAXBUF]; data/portsentry-1.2/portsentry_io.c:593: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 commandStringTemp2[MAXBUF], commandStringFinal[MAXBUF]; data/portsentry-1.2/portsentry_io.c:594: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 portString[MAXBUF]; data/portsentry-1.2/portsentry_io.c:633: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 ((output = fopen (WRAPPER_HOSTS_DENY, "a")) == NULL) data/portsentry-1.2/portsentry_io.c:654: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 buffer[MAXBUF], tempBuffer[MAXBUF]; data/portsentry-1.2/portsentry_io.c:662:16: [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 ((input = fopen (filename, "r")) == NULL) data/portsentry-1.2/portsentry_io.c:718:1: [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 tempString[MAXBUF], *tempStringPtr; data/portsentry-1.2/portsentry_io.c:773: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 configToken[MAXBUF]; data/portsentry-1.2/portsentry_io.c:780: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). return (atoi(configToken)); data/portsentry-1.2/portsentry.c:238: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). if (strlen (gblBlockedFile) < MAXBUF - 5) data/portsentry-1.2/portsentry.c:240:4: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is low because the source is a constant character. strncat (gblBlockedFile, ".", 1); data/portsentry-1.2/portsentry.c:241:4: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat (gblBlockedFile, gblDetectionType, 4); data/portsentry-1.2/portsentry.c:316:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if(read (socket, packetBuffer, TCPPACKETLEN) == ERROR) data/portsentry-1.2/portsentry.c:348:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if(read (socket, packetBuffer, UDPPACKETLEN) == ERROR) data/portsentry-1.2/portsentry.c:1217: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). strlen (bannerBuffer)); data/portsentry-1.2/portsentry.c:1414: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 (bannerBuffer), 0, data/portsentry-1.2/portsentry.c:1474: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). strlen (gblKillRoute)); data/portsentry-1.2/portsentry.c:1482: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). if (strlen (gblKillRunCmd) > 0) data/portsentry-1.2/portsentry.c:1485: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). if (strlen (gblKillHostsDeny) > 0) data/portsentry-1.2/portsentry.c:1488: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). if (strlen (gblKillRoute) > 0) data/portsentry-1.2/portsentry.c:1495: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). if (strlen (gblKillHostsDeny) > 0) data/portsentry-1.2/portsentry.c:1498: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). if (strlen (gblKillRoute) > 0) data/portsentry-1.2/portsentry.c:1501: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). if (strlen (gblKillRunCmd) > 0) data/portsentry-1.2/portsentry.c:1509: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). if (strlen (gblKillRunCmd) > 0) data/portsentry-1.2/portsentry.c:1533: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). strlen (gblKillRoute)); data/portsentry-1.2/portsentry.c:1541: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). if (strlen (gblKillRunCmd) > 0) data/portsentry-1.2/portsentry.c:1544: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). if (strlen (gblKillHostsDeny) > 0) data/portsentry-1.2/portsentry.c:1547: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). if (strlen (gblKillRoute) > 0) data/portsentry-1.2/portsentry.c:1554: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). if (strlen (gblKillHostsDeny) > 0) data/portsentry-1.2/portsentry.c:1557: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). if (strlen (gblKillRoute) > 0) data/portsentry-1.2/portsentry.c:1560: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). if (strlen (gblKillRunCmd) > 0) data/portsentry-1.2/portsentry.c:1568: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). if (strlen (gblKillRunCmd) > 0) data/portsentry-1.2/portsentry_io.c:85:3: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask (077); data/portsentry-1.2/portsentry_io.c:154:25: [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(count = 0; count < strlen(buffer); count++) data/portsentry-1.2/portsentry_io.c:322: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). ((buffer[strlen(token)] == '=') || (buffer[strlen(token)] == ' '))) data/portsentry-1.2/portsentry_io.c:322: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). ((buffer[strlen(token)] == '=') || (buffer[strlen(token)] == ' '))) data/portsentry-1.2/portsentry_io.c:672:26: [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(count = 0; count < strlen(ipOffset); count++) data/portsentry-1.2/portsentry_io.c:721:64: [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). Log ("debug: SubstString: Processing string: %s %d", target, strlen(target)); data/portsentry-1.2/portsentry_io.c:722:70: [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). Log ("debug: SubstString: Processing search text: %s %d", replace, strlen(replace)); data/portsentry-1.2/portsentry_io.c:723:68: [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). Log ("debug: SubstString: Processing replace text: %s %d", find, strlen(find)); data/portsentry-1.2/portsentry_io.c:729:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(result, target, MAXBUF); data/portsentry-1.2/portsentry_io.c:736:14: [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). else if ((strlen (target)) + (strlen(replace)) + (strlen(find)) > MAXBUF) data/portsentry-1.2/portsentry_io.c:736: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). else if ((strlen (target)) + (strlen(replace)) + (strlen(find)) > MAXBUF) data/portsentry-1.2/portsentry_io.c:736:54: [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). else if ((strlen (target)) + (strlen(replace)) + (strlen(find)) > MAXBUF) data/portsentry-1.2/portsentry_io.c:741: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). findLen = strlen(find); data/portsentry-1.2/portsentry_io.c:753:41: [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(replaceCount = 0; replaceCount < strlen(replace); replaceCount++) data/portsentry-1.2/portsentry_io.c:760:1: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(result, tempString, MAXBUF); data/portsentry-1.2/portsentry_util.c:42:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (dest, src, size - 1); ANALYSIS SUMMARY: Hits = 113 Lines analyzed = 3120 in approximately 0.10 seconds (30183 lines/second) Physical Source Lines of Code (SLOC) = 2283 Hits@level = [0] 46 [1] 39 [2] 69 [3] 0 [4] 5 [5] 0 Hits@level+ = [0+] 159 [1+] 113 [2+] 74 [3+] 5 [4+] 5 [5+] 0 Hits/KSLOC@level+ = [0+] 69.6452 [1+] 49.4963 [2+] 32.4135 [3+] 2.1901 [4+] 2.1901 [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.