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/i2p-0.9.47/apps/sam/c/src/parse.c Examining data/i2p-0.9.47/apps/sam/c/src/tinystring.c Examining data/i2p-0.9.47/apps/sam/c/src/strl.c Examining data/i2p-0.9.47/apps/sam/c/src/sam.c Examining data/i2p-0.9.47/apps/sam/c/src/snprintf.c Examining data/i2p-0.9.47/apps/sam/c/examples/warhammer/warhammer-dgram.c Examining data/i2p-0.9.47/apps/sam/c/examples/i2p-ping/i2p-ping.c Examining data/i2p-0.9.47/apps/sam/c/inc/strl.h Examining data/i2p-0.9.47/apps/sam/c/inc/platform.h Examining data/i2p-0.9.47/apps/sam/c/inc/tinystring.h Examining data/i2p-0.9.47/apps/sam/c/inc/snprintf.h Examining data/i2p-0.9.47/apps/sam/c/inc/parse.h Examining data/i2p-0.9.47/apps/sam/c/inc/sam.h Examining data/i2p-0.9.47/core/c/jbigi/jbigi/include/jbigi.h Examining data/i2p-0.9.47/core/c/jbigi/jbigi/src/jbigi.c Examining data/i2p-0.9.47/core/c/jcpuid/include/jcpuid.h Examining data/i2p-0.9.47/core/c/jcpuid/src/jcpuid.c FINAL RESULTS: data/i2p-0.9.47/apps/sam/c/inc/snprintf.h:43:5: [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. int snprintf (char *str, size_t count, const char *fmt, ...); data/i2p-0.9.47/apps/sam/c/inc/snprintf.h:44:5: [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. int vsnprintf (char *str, size_t count, const char *fmt, va_list arg); data/i2p-0.9.47/apps/sam/c/src/sam.c:281:2: [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(s, sizeof s, format, ap); data/i2p-0.9.47/apps/sam/c/src/snprintf.c:92:5: [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. int snprintf (char *str, size_t count, const char *fmt, ...); data/i2p-0.9.47/apps/sam/c/src/snprintf.c:93:5: [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. int vsnprintf (char *str, size_t count, const char *fmt, va_list arg); data/i2p-0.9.47/apps/sam/c/src/snprintf.c:746:5: [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. int vsnprintf (char *str, size_t count, const char *fmt, va_list args) data/i2p-0.9.47/apps/sam/c/src/snprintf.c:755:5: [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. int snprintf (char *str,size_t count,const char *fmt,...) data/i2p-0.9.47/apps/sam/c/src/snprintf.c:757:5: [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. int snprintf (va_alist) va_dcl data/i2p-0.9.47/apps/sam/c/src/snprintf.c:772:11: [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. total = vsnprintf(str, count, fmt, ap); data/i2p-0.9.47/apps/sam/c/src/snprintf.c:825:7: [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 (buf1, sizeof (buf1), fp_fmt[x], fp_nums[y]); data/i2p-0.9.47/apps/sam/c/src/snprintf.c:826:7: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf (buf2, fp_fmt[x], fp_nums[y]); data/i2p-0.9.47/apps/sam/c/src/snprintf.c:839:7: [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 (buf1, sizeof (buf1), int_fmt[x], int_nums[y]); data/i2p-0.9.47/apps/sam/c/src/snprintf.c:840:7: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf (buf2, int_fmt[x], int_nums[y]); data/i2p-0.9.47/apps/sam/c/src/tinystring.c:58:5: [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(tmp, fmt, args); data/i2p-0.9.47/apps/sam/c/examples/i2p-ping/i2p-ping.c:84:15: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((ch = getopt(argc, argv, "ac:h:mp:qv")) != -1) { data/i2p-0.9.47/apps/sam/c/examples/i2p-ping/i2p-ping.c:90:13: [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). count = atoi(optarg); data/i2p-0.9.47/apps/sam/c/examples/i2p-ping/i2p-ping.c:101: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). samport = atoi(optarg); data/i2p-0.9.47/apps/sam/c/examples/i2p-ping/i2p-ping.c:145: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(dest, argv[j], SAM_PUBKEY_LEN); data/i2p-0.9.47/apps/sam/c/examples/i2p-ping/i2p-ping.c:253: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(dest, pubkey, SAM_PUBKEY_LEN); data/i2p-0.9.47/apps/sam/c/examples/warhammer/warhammer-dgram.c:98: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(dest, argv[1], SAM_PUBKEY_LEN); data/i2p-0.9.47/apps/sam/c/examples/warhammer/warhammer-dgram.c:112: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 data[SAM_DGRAM_PAYLOAD_MAX]; data/i2p-0.9.47/apps/sam/c/examples/warhammer/warhammer-dgram.c:182: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(dest, pubkey, SAM_PUBKEY_LEN); data/i2p-0.9.47/apps/sam/c/inc/sam.h:77: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. typedef char sam_pubkey_t[SAM_PUBKEY_LEN]; /* base 64 public key */ data/i2p-0.9.47/apps/sam/c/src/sam.c:226: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 cmd[SAM_PKCMD_LEN]; data/i2p-0.9.47/apps/sam/c/src/sam.c:260: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 reply[SAM_REPLY_LEN]; data/i2p-0.9.47/apps/sam/c/src/sam.c:278: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 s[SAM_LOGMSG_LEN]; data/i2p-0.9.47/apps/sam/c/src/sam.c:297: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 cmd[SAM_CMD_LEN]; data/i2p-0.9.47/apps/sam/c/src/sam.c:510: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 cmd[SAM_PKCMD_LEN]; data/i2p-0.9.47/apps/sam/c/src/sam.c:542: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 reply[SAM_REPLY_LEN]; data/i2p-0.9.47/apps/sam/c/src/sam.c:755: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((*sendq)->data + (*sendq)->size, data, dsize); data/i2p-0.9.47/apps/sam/c/src/sam.c:762: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((*sendq)->data + (*sendq)->size, data, dsize); data/i2p-0.9.47/apps/sam/c/src/sam.c:770: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((*sendq)->data + (*sendq)->size, data, s); //append as much as we can data/i2p-0.9.47/apps/sam/c/src/sam.c:842: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 cmd[SAM_CMD_LEN * 2]; data/i2p-0.9.47/apps/sam/c/src/sam.c:843: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 reply[SAM_REPLY_LEN]; data/i2p-0.9.47/apps/sam/c/src/sam.c:927: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 ipaddr[INET_ADDRSTRLEN]; data/i2p-0.9.47/apps/sam/c/src/sam.c:1037: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 cmd[SAM_CMD_LEN]; data/i2p-0.9.47/apps/sam/c/src/sam.c:1055: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 cmd[SAM_PKCMD_LEN]; data/i2p-0.9.47/apps/sam/c/src/sam.c:1078: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 cmd[SAM_CMD_LEN]; data/i2p-0.9.47/apps/sam/c/src/snprintf.c:472: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 convert[24]; data/i2p-0.9.47/apps/sam/c/src/snprintf.c:602: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 iconvert[20]; data/i2p-0.9.47/apps/sam/c/src/snprintf.c:603: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 fconvert[20]; data/i2p-0.9.47/apps/sam/c/src/snprintf.c:783: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 buf1[LONG_STRING]; data/i2p-0.9.47/apps/sam/c/src/snprintf.c:784: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 buf2[LONG_STRING]; data/i2p-0.9.47/apps/sam/c/src/tinystring.c:54:17: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). FILE* tmp = tmpfile(); data/i2p-0.9.47/apps/sam/c/src/tinystring.c:78: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(data, head->data, head->size); data/i2p-0.9.47/apps/sam/c/src/tinystring.c:79: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(data+head->size,tail->data,tail->size); data/i2p-0.9.47/apps/sam/c/src/tinystring.c:87: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((char*)dest->data,src->data,dest->size); data/i2p-0.9.47/apps/sam/c/src/tinystring.c:92: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(dest,src->data,size); data/i2p-0.9.47/apps/sam/c/examples/i2p-ping/i2p-ping.c:144:7: [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(argv[j]) == SAM_PUBKEY_LEN - 1) { data/i2p-0.9.47/apps/sam/c/examples/warhammer/warhammer-dgram.c:97:6: [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(argv[1]) == SAM_PUBKEY_LEN - 1) { data/i2p-0.9.47/apps/sam/c/src/sam.c:243: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). sam_write(session, cmd, strlen(cmd)); data/i2p-0.9.47/apps/sam/c/src/sam.c:262:36: [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). sam_write(session, SAM_HELLO_CMD, strlen(SAM_HELLO_CMD)); data/i2p-0.9.47/apps/sam/c/src/sam.c:264:38: [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 (strncmp(reply, SAM_HELLO_REPLY, strlen(SAM_HELLO_REPLY)) == 0) data/i2p-0.9.47/apps/sam/c/src/sam.c:300:29: [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). sam_write(session, cmd, strlen(cmd)); data/i2p-0.9.47/apps/sam/c/src/sam.c:527: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). sam_write(session, cmd, strlen(cmd)); data/i2p-0.9.47/apps/sam/c/src/sam.c:862: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). sam_write(session, cmd, strlen(cmd)); data/i2p-0.9.47/apps/sam/c/src/sam.c:865:4: [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(SAM_SESSTATUS_REPLY_OK)) == 0) data/i2p-0.9.47/apps/sam/c/src/sam.c:868:4: [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(SAM_SESSTATUS_REPLY_DD)) == 0) data/i2p-0.9.47/apps/sam/c/src/sam.c:871:4: [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(SAM_SESSTATUS_REPLY_I2E)) == 0) data/i2p-0.9.47/apps/sam/c/src/sam.c:874:4: [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(SAM_SESSTATUS_REPLY_IK)) == 0) data/i2p-0.9.47/apps/sam/c/src/sam.c:1040: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). sam_write(session, cmd, strlen(cmd)); data/i2p-0.9.47/apps/sam/c/src/sam.c:1060: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). sam_write(session, cmd, strlen(cmd)); data/i2p-0.9.47/apps/sam/c/src/sam.c:1096: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). sam_write(session, cmd, strlen(cmd)); data/i2p-0.9.47/apps/sam/c/src/strl.c:42: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). return(dlen + strlen(s)); data/i2p-0.9.47/apps/sam/c/src/tinystring.c:35: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). return string_ncreate(cstr, strlen(cstr)); data/i2p-0.9.47/apps/sam/c/src/tinystring.c:49:31: [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). return string_nwrap(cstr, strlen(cstr)); data/i2p-0.9.47/core/c/jbigi/jbigi/src/jbigi.c:58: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). if (strlen(gmp_version) > 2) { data/i2p-0.9.47/core/c/jbigi/jbigi/src/jbigi.c:68: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). if (strlen(gmp_version) > 4) { ANALYSIS SUMMARY: Hits = 68 Lines analyzed = 4059 in approximately 0.72 seconds (5615 lines/second) Physical Source Lines of Code (SLOC) = 2589 Hits@level = [0] 48 [1] 20 [2] 33 [3] 1 [4] 14 [5] 0 Hits@level+ = [0+] 116 [1+] 68 [2+] 48 [3+] 15 [4+] 14 [5+] 0 Hits/KSLOC@level+ = [0+] 44.8049 [1+] 26.265 [2+] 18.54 [3+] 5.79374 [4+] 5.40749 [5+] 0 Dot directories skipped = 4 (--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.