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/libnids-1.24/src/libnids.c Examining data/libnids-1.24/src/util.h Examining data/libnids-1.24/src/hash.c Examining data/libnids-1.24/src/allpromisc.c Examining data/libnids-1.24/src/scan.h Examining data/libnids-1.24/src/killtcp.c Examining data/libnids-1.24/src/tcp.c Examining data/libnids-1.24/src/ip_fragment.c Examining data/libnids-1.24/src/util.c Examining data/libnids-1.24/src/hash.h Examining data/libnids-1.24/src/tcp.h Examining data/libnids-1.24/src/ip_options.c Examining data/libnids-1.24/src/scan.c Examining data/libnids-1.24/src/nids.h Examining data/libnids-1.24/src/checksum.h Examining data/libnids-1.24/src/ip_fragment.h Examining data/libnids-1.24/src/checksum.c Examining data/libnids-1.24/samples/overflows.c Examining data/libnids-1.24/samples/chksum_ctl.c Examining data/libnids-1.24/samples/nids_next.c Examining data/libnids-1.24/samples/printall.c Examining data/libnids-1.24/samples/sniff.c FINAL RESULTS: data/libnids-1.24/src/libnids.c:529:2: [5] (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 high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat(nids_errbuf, strerror(errno), sizeof(nids_errbuf) - 1); data/libnids-1.24/src/libnids.c:535:2: [5] (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 high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat(nids_errbuf, strerror(errno), sizeof(nids_errbuf) - 1); data/libnids-1.24/samples/overflows.c:31: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, int_ntoa (addr.saddr)); data/libnids-1.24/samples/overflows.c:33: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 (buf, int_ntoa (addr.daddr)); data/libnids-1.24/samples/printall.c:25: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, int_ntoa (addr.saddr)); data/libnids-1.24/samples/printall.c:27: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 (buf, int_ntoa (addr.daddr)); data/libnids-1.24/samples/printall.c:36: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, adres (a_tcp->addr)); // we put conn params into buf data/libnids-1.24/samples/sniff.c:24: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, int_ntoa (addr.saddr)); data/libnids-1.24/samples/sniff.c:26: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 (buf, int_ntoa (addr.daddr)); data/libnids-1.24/src/ip_fragment.c:486:17: [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. nids_params.syslog(NIDS_WARN_IP, NIDS_WARN_IP_OVERSIZED, qp->iph, 0); data/libnids-1.24/src/ip_fragment.c:507:19: [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. nids_params.syslog(NIDS_WARN_IP, NIDS_WARN_IP_INVLIST, qp->iph, 0); data/libnids-1.24/src/ip_fragment.c:602:17: [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. nids_params.syslog(NIDS_WARN_IP, NIDS_WARN_IP_OVERSIZED, iph, 0); data/libnids-1.24/src/ip_fragment.c:633:17: [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. nids_params.syslog(NIDS_WARN_IP, NIDS_WARN_IP_OVERLAP, iph, 0); data/libnids-1.24/src/ip_fragment.c:646:17: [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. nids_params.syslog(NIDS_WARN_IP, NIDS_WARN_IP_OVERLAP, iph, 0); data/libnids-1.24/src/libnids.c:133:6: [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(saddr, int_ntoa(iph->ip_src.s_addr)); data/libnids-1.24/src/libnids.c:134:6: [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(daddr, int_ntoa(iph->ip_dst.s_addr)); data/libnids-1.24/src/libnids.c:144: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(saddr, int_ntoa(iph->ip_src.s_addr)); data/libnids-1.24/src/libnids.c:145: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(daddr, int_ntoa(iph->ip_dst.s_addr)); data/libnids-1.24/src/libnids.c:158:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf, "Scan from %s. Scanned ports: ", data/libnids-1.24/src/libnids.c:161:6: [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(buf, int_ntoa(this_host->packets[i].addr)); data/libnids-1.24/src/libnids.c:369:21: [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. nids_params.syslog; data/libnids-1.24/src/nids.h:119:10: [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) (); data/libnids-1.24/src/scan.c:124:17: [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. nids_params.syslog(NIDS_WARN_SCAN, 0, 0, this_host); data/libnids-1.24/src/tcp.c:277:19: [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. nids_params.syslog(NIDS_WARN_TCP, NIDS_WARN_TCP_TOOMUCH, ugly_iphdr, this_tcphdr); data/libnids-1.24/src/tcp.c:603:15: [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. nids_params.syslog(NIDS_WARN_TCP, NIDS_WARN_TCP_BIGQUEUE, ugly_iphdr, this_tcphdr); data/libnids-1.24/src/tcp.c:630:17: [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. nids_params.syslog(NIDS_WARN_TCP, NIDS_WARN_TCP_BADFLAGS, iph, th); data/libnids-1.24/src/tcp.c:721:17: [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. nids_params.syslog(NIDS_WARN_TCP, NIDS_WARN_TCP_HDR, this_iphdr, data/libnids-1.24/src/tcp.c:729:17: [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. nids_params.syslog(NIDS_WARN_TCP, NIDS_WARN_TCP_HDR, this_iphdr, data/libnids-1.24/src/tcp.c:735:17: [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. nids_params.syslog(NIDS_WARN_TCP, NIDS_WARN_TCP_HDR, this_iphdr, data/libnids-1.24/src/tcp.c:744:17: [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. nids_params.syslog(NIDS_WARN_TCP, NIDS_WARN_TCP_HDR, this_iphdr, data/libnids-1.24/src/hash.c:25:3: [3] (random) srand: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srand (s.tv_usec); data/libnids-1.24/samples/overflows.c:30: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 buf[256]; data/libnids-1.24/samples/overflows.c:32:3: [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 (buf + strlen (buf), ",%i,", addr.source); data/libnids-1.24/samples/overflows.c:34:3: [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 (buf + strlen (buf), ",%i", addr.dest); data/libnids-1.24/samples/overflows.c:50: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 numbuf[30]; data/libnids-1.24/samples/overflows.c:94: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 (numbuf, hlf->data + i + PATLEN, numberlen); //numbuf contains data/libnids-1.24/samples/overflows.c:97:7: [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). if (atoi (numbuf) > 1024) data/libnids-1.24/samples/printall.c:24: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 buf[256]; data/libnids-1.24/samples/printall.c:26:3: [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 (buf + strlen (buf), ",%i,", addr.source); data/libnids-1.24/samples/printall.c:28:3: [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 (buf + strlen (buf), ",%i", addr.dest); data/libnids-1.24/samples/printall.c:35: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/libnids-1.24/samples/printall.c:78:9: [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(buf,"(urgent->)"); data/libnids-1.24/samples/printall.c:92:4: [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 (buf, "(<-)"); // symbolic direction of data data/libnids-1.24/samples/printall.c:97:4: [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 (buf, "(->)"); data/libnids-1.24/samples/sniff.c:23: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 buf[256]; data/libnids-1.24/samples/sniff.c:25:3: [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 (buf + strlen (buf), ",%i,", addr.source); data/libnids-1.24/samples/sniff.c:27:3: [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 (buf + strlen (buf), ",%i : ", addr.dest); data/libnids-1.24/samples/sniff.c:79: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). logfd = open ("./logfile", O_WRONLY | O_CREAT | O_TRUNC, 0600); data/libnids-1.24/src/hash.c:15: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). int fd = open ("/dev/urandom", O_RDONLY); data/libnids-1.24/src/ip_fragment.c:418: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(qp->iph, iph, ihlen + 8); data/libnids-1.24/src/ip_fragment.c:498: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(ptr, ((unsigned char *) qp->iph), qp->ihlen); data/libnids-1.24/src/ip_fragment.c:514: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((ptr + fp->offset), fp->ptr, fp->len); data/libnids-1.24/src/ip_fragment.c:584: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(qp->iph, iph, ihl + 8); data/libnids-1.24/src/ip_fragment.c:732: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(skb->data, iph, tot_len); data/libnids-1.24/src/ip_options.c:102: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 optholder[16]; data/libnids-1.24/src/ip_options.c:154: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(&opt->faddr, &optptr[3], 4); data/libnids-1.24/src/ip_options.c:180: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(&optptr[optptr[2] - 1], &skb_pa_addr, 4); data/libnids-1.24/src/ip_options.c:224:6: [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(&optptr[ts->ptr - 1], &skb_pa_addr, 4); data/libnids-1.24/src/ip_options.c:240:6: [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, &optptr[ts->ptr - 1], 4); data/libnids-1.24/src/ip_options.c:260: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(timeptr, &midtime, sizeof(__u32)); data/libnids-1.24/src/killtcp.c:19:5: [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[IP_H + TCP_H]; data/libnids-1.24/src/killtcp.c:65:5: [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 errbuf[1024]; data/libnids-1.24/src/libnids.c:72: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 nids_errbuf[PCAP_ERRBUF_SIZE]; data/libnids-1.24/src/libnids.c:123:5: [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 saddr[20], daddr[20]; data/libnids-1.24/src/libnids.c:124:5: [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/libnids-1.24/src/libnids.c:162:6: [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(buf + strlen(buf), ":%hu,", data/libnids-1.24/src/libnids.c:171:3: [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(buf, "scan type: SYN"); data/libnids-1.24/src/libnids.c:174:3: [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(buf, "scan type: NULL"); data/libnids-1.24/src/libnids.c:177:3: [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(buf, "scan type: FIN"); data/libnids-1.24/src/libnids.c:180:3: [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(buf + strlen(buf), "flags=0x%x", i); data/libnids-1.24/src/libnids.c:183:6: [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(buf, "various flags"); data/libnids-1.24/src/libnids.c:326: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(data_aligned, data + nids_linkoffset, hdr->caplen - nids_linkoffset); data/libnids-1.24/src/libnids.c:341:11: [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(qitem->data,data_aligned,qitem->caplen); data/libnids-1.24/src/libnids.c:546:6: [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(nids_errbuf, "thread: "); \ data/libnids-1.24/src/libnids.c:653: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(nids_errbuf, "link type unknown"); data/libnids-1.24/src/libnids.c:675: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(nids_errbuf, "libnids was compiled without threads support"); data/libnids-1.24/src/libnids.c:686: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(nids_errbuf, "Libnids not initialized"); data/libnids-1.24/src/libnids.c:700:9: [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(nids_errbuf, "Libnids not initialized"); data/libnids-1.24/src/libnids.c:715: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(nids_errbuf, "loop: "); data/libnids-1.24/src/libnids.c:728: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(nids_errbuf, "Libnids not initialized"); data/libnids-1.24/src/libnids.c:740: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(nids_errbuf, "Libnids not initialized"); data/libnids-1.24/src/libnids.c:744: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(nids_errbuf, "next: "); data/libnids-1.24/src/libnids.c:760: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(nids_errbuf, "Libnids not initialized"); data/libnids-1.24/src/libnids.c:766: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(nids_errbuf, "dispatch: "); data/libnids-1.24/src/tcp.c:209:6: [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((char*)&tmp_ts, options + ind + 2, 4); data/libnids-1.24/src/tcp.c:337: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(rcv->data + rcv->count - rcv->offset, data, datalen); data/libnids-1.24/src/tcp.c:554: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(pakiet->data, data, datalen); data/libnids-1.24/samples/overflows.c:32:18: [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), ",%i,", addr.source); data/libnids-1.24/samples/overflows.c:34:18: [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), ",%i", addr.dest); data/libnids-1.24/samples/overflows.c:46: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). #define PATLEN strlen(PATTERN) data/libnids-1.24/samples/overflows.c:134: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). plen = strlen (path); data/libnids-1.24/samples/overflows.c:139:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(path+1,elem,len); data/libnids-1.24/samples/overflows.c:145:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (path + plen + 1, elem, len); data/libnids-1.24/samples/overflows.c:173:8: [1] (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 character. strcpy (p->currdir, "/"); data/libnids-1.24/samples/overflows.c:214:4: [1] (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 character. strcpy (one_for_conn->currdir, "/"); data/libnids-1.24/samples/printall.c:26:18: [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), ",%i,", addr.source); data/libnids-1.24/samples/printall.c:28:18: [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), ",%i", addr.dest); data/libnids-1.24/samples/printall.c:79:13: [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[strlen(buf)+1]=0; data/libnids-1.24/samples/printall.c:80:13: [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[strlen(buf)]=a_tcp->server.urgdata; data/libnids-1.24/samples/printall.c:81:21: [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). write(1,buf,strlen(buf)); data/libnids-1.24/samples/sniff.c:25:18: [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), ",%i,", addr.source); data/libnids-1.24/samples/sniff.c:27:18: [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), ",%i : ", addr.dest); data/libnids-1.24/samples/sniff.c:35: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). write (logfd, adres_txt, strlen (adres_txt)); data/libnids-1.24/samples/sniff.c:37:27: [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). write (logfd, SZLACZEK, strlen (SZLACZEK)); data/libnids-1.24/src/hash.c:18:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read (fd, xor, 12); data/libnids-1.24/src/hash.c:19:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read (fd, perm, 12); data/libnids-1.24/src/libnids.c:162: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). sprintf(buf + strlen(buf), ":%hu,", data/libnids-1.24/src/libnids.c:180: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). sprintf(buf + strlen(buf), "flags=0x%x", i); data/libnids-1.24/src/libnids.c:547:6: [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(nids_errbuf, gerror->message, sizeof(nids_errbuf) - 8); \ data/libnids-1.24/src/libnids.c:709:9: [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(100000); data/libnids-1.24/src/libnids.c:716:5: [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(nids_errbuf, pcap_geterr(desc), sizeof nids_errbuf - 7); data/libnids-1.24/src/libnids.c:745:2: [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(nids_errbuf, pcap_geterr(desc), sizeof(nids_errbuf) - 7); data/libnids-1.24/src/libnids.c:767:2: [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(nids_errbuf, pcap_geterr(desc), sizeof(nids_errbuf) - 11); data/libnids-1.24/src/nids.h:106:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int read; data/libnids-1.24/src/tcp.c:399:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). total=a_tcp->read; data/libnids-1.24/src/tcp.c:402:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (a_tcp->read>total-rcv->count_new) data/libnids-1.24/src/tcp.c:403:35: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). rcv->count_new=total-a_tcp->read; data/libnids-1.24/src/tcp.c:405:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (a_tcp->read > 0) { data/libnids-1.24/src/tcp.c:406:46: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). memmove(rcv->data, rcv->data + a_tcp->read, rcv->count - rcv->offset - a_tcp->read); data/libnids-1.24/src/tcp.c:406:86: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). memmove(rcv->data, rcv->data + a_tcp->read, rcv->count - rcv->offset - a_tcp->read); data/libnids-1.24/src/tcp.c:407:30: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). rcv->offset += a_tcp->read; data/libnids-1.24/src/tcp.c:409:46: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). }while (nids_params.one_loop_less && a_tcp->read>0 && rcv->count_new); data/libnids-1.24/src/tcp.c:908:20: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (num < a_tcp->read) ANALYSIS SUMMARY: Hits = 123 Lines analyzed = 4519 in approximately 0.18 seconds (25383 lines/second) Physical Source Lines of Code (SLOC) = 3706 Hits@level = [0] 21 [1] 36 [2] 56 [3] 1 [4] 28 [5] 2 Hits@level+ = [0+] 144 [1+] 123 [2+] 87 [3+] 31 [4+] 30 [5+] 2 Hits/KSLOC@level+ = [0+] 38.8559 [1+] 33.1894 [2+] 23.4754 [3+] 8.36481 [4+] 8.09498 [5+] 0.539665 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.