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/ipip-1.1.10/config.c Examining data/ipip-1.1.10/ip.c Examining data/ipip-1.1.10/ipip.h Examining data/ipip-1.1.10/main.c Examining data/ipip-1.1.10/route.c Examining data/ipip-1.1.10/run.c Examining data/ipip-1.1.10/slip.c Examining data/ipip-1.1.10/test/udp_i.c Examining data/ipip-1.1.10/test/udp_o.c Examining data/ipip-1.1.10/tun.c Examining data/ipip-1.1.10/version.h FINAL RESULTS: data/ipip-1.1.10/config.c:155:8: [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. (void)fprintf(stderr,s,a); data/ipip-1.1.10/ip.c:184:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(bugger, data/ipip-1.1.10/ipip.h:138:24: [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 PERR(x) {(void)syslog(LOG_ERR,x);} data/ipip-1.1.10/route.c:156:8: [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(LOG_ERR,s,a); data/ipip-1.1.10/config.c:40: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[256], *p; data/ipip-1.1.10/config.c:45:11: [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((cf = fopen(f,"r"))==NULL){ data/ipip-1.1.10/config.c:211:23: [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). ifs[ifs_top].unit = atoi(q); data/ipip-1.1.10/ip.c:92:11: [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[MAX_SIZE], *p; data/ipip-1.1.10/ip.c:136:8: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void)memcpy((char *)m->msg,(char *)p, n); data/ipip-1.1.10/ip.c:138:8: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void)memcpy( (char *)&(m->fip), (char *)&ip_from.sin_addr, 4); data/ipip-1.1.10/ip.c:176:8: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void)memcpy((char *)&ip_to.sin_addr, (char *)&(m->tip), 4); data/ipip-1.1.10/ip.c:182: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 bugger[80]; data/ipip-1.1.10/ipip.h:104:11: [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 msg[MAX_SIZE]; /* the packet itself */ data/ipip-1.1.10/main.c:40: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 progname[32]; data/ipip-1.1.10/main.c:64:8: [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. (void)sprintf(progname,"ipip[%d]: ",getpid()); data/ipip-1.1.10/main.c:67:18: [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(!(pid_file = fopen(PIDLOG,"w"))) { data/ipip-1.1.10/main.c:87: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). if(i<argc)stat_interval = atoi(argv[i]) * 60; data/ipip-1.1.10/route.c: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 buf[256], *p; data/ipip-1.1.10/route.c:52:11: [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((cf = fopen(f,"r"))==NULL){ data/ipip-1.1.10/route.c:181:10: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void)memcpy((char *)&rts[rts_top].ipaddr, data/ipip-1.1.10/route.c:203:10: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void)memcpy((char *)&rts[rts_top].destaddr, data/ipip-1.1.10/route.c:212:49: [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). rts[rts_top].destport = htons((unsigned short)atoi(q)); data/ipip-1.1.10/run.c:164:8: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void)memcpy( (char *)&srcip, (char *)m.msg + 12, 4); data/ipip-1.1.10/run.c:165:8: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void)memcpy( (char *)&dstip, (char *)m.msg + 16, 4); data/ipip-1.1.10/run.c:213: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 *fromid, *toid, fbuf[32], tbuf[32]; data/ipip-1.1.10/run.c:221:9: [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. (void)sprintf(fbuf,"(%d.%d.%d.%d:%d)",f[0],f[1],f[2],f[3],ntohs(m->fport)); data/ipip-1.1.10/run.c:223:9: [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. (void)sprintf(fbuf, "(%d.%d.%d.%d)", f[0], f[1], f[2], f[3]); data/ipip-1.1.10/run.c:236:9: [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. (void)sprintf(tbuf,"(%d.%d.%d.%d:%d)",t[0],t[1],t[2],t[3],ntohs(m->tport)); data/ipip-1.1.10/run.c:238:9: [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. (void)sprintf(tbuf, "(%d.%d.%d.%d)",t[0],t[1],t[2],t[3]); data/ipip-1.1.10/run.c:269:8: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void)memcpy( (char *)&d, (char *)m->msg + 16, 4); data/ipip-1.1.10/run.c:305: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 cnow[32]; data/ipip-1.1.10/run.c:321:9: [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. (void)sprintf(cnow,"%2d/%2d/%2d %2d:%2d:%2d ",t->tm_mon + 1, data/ipip-1.1.10/slip.c:78:11: [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 buffer[MAX_SIZE]; /* buffer from the serial line */ data/ipip-1.1.10/slip.c:81:11: [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 ipacket[MAX_SIZE]; /* the packet we are assembling */ data/ipip-1.1.10/slip.c:113: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). ifp->fd = open(ifp->devname, O_RDWR | O_NONBLOCK); data/ipip-1.1.10/slip.c:115: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). ifp->fd = open(ifp->devname, O_RDWR); data/ipip-1.1.10/slip.c:257:10: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void)memcpy((char *)m->msg, (char *)s->ipacket, n); data/ipip-1.1.10/slip.c:280:11: [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 opacket[MAX_SIZE*2], *ofptr, *mptr; data/ipip-1.1.10/test/udp_i.c:22: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[BUFSIZE], *buftext; data/ipip-1.1.10/test/udp_i.c:26: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 myhost[65], *the_host; data/ipip-1.1.10/test/udp_i.c:39: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). if(argc>2)portno = atoi(argv[2]); data/ipip-1.1.10/test/udp_i.c:61:2: [2] (buffer) bcopy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. bcopy(hp->h_addr_list[0], (char *)&to.sin_addr, hp->h_length); data/ipip-1.1.10/test/udp_o.c:20: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[BUFSIZE], *p; data/ipip-1.1.10/test/udp_o.c:30: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). if(argc>1)portno = atoi(argv[1]); data/ipip-1.1.10/tun.c:49: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). ifp->fd = open(ifp->devname, O_RDWR); data/ipip-1.1.10/slip.c:242:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). n = read(ifp->fd, (char *)s->buffer, MAX_SIZE); data/ipip-1.1.10/test/udp_i.c:83: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). if (sendto(sock, buf, (strlen(buftext)+40), 0, (struct sockaddr *)&to, sizeof to) < 0) { data/ipip-1.1.10/tun.c:82:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). n = read(ifp->fd, (char *)m->msg, MAX_SIZE); ANALYSIS SUMMARY: Hits = 48 Lines analyzed = 2092 in approximately 0.09 seconds (22654 lines/second) Physical Source Lines of Code (SLOC) = 1459 Hits@level = [0] 64 [1] 3 [2] 41 [3] 0 [4] 4 [5] 0 Hits@level+ = [0+] 112 [1+] 48 [2+] 45 [3+] 4 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 76.7649 [1+] 32.8992 [2+] 30.843 [3+] 2.7416 [4+] 2.7416 [5+] 0 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.