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/ruby-ldap-0.9.20/rbldap.h Examining data/ruby-ldap-0.9.20/clientauth.c Examining data/ruby-ldap-0.9.20/misc.c Examining data/ruby-ldap-0.9.20/mod.c Examining data/ruby-ldap-0.9.20/entry.c Examining data/ruby-ldap-0.9.20/conn.c Examining data/ruby-ldap-0.9.20/win/winldap.h Examining data/ruby-ldap-0.9.20/win/winlber.h Examining data/ruby-ldap-0.9.20/saslconn.c Examining data/ruby-ldap-0.9.20/ldap.c Examining data/ruby-ldap-0.9.20/sslconn.c FINAL RESULTS: data/ruby-ldap-0.9.20/clientauth.c:555: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. vsnprintf(buf, sizeof(buf) - 1, format, ap); data/ruby-ldap-0.9.20/entry.c:306:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (RSTRING_PTR (str), "#<%s:0x%lx\n", c, self); data/ruby-ldap-0.9.20/mod.c:58: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(mod->mod_type, mod_type); data/ruby-ldap-0.9.20/mod.c:90: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(mod->mod_type, mod_type); data/ruby-ldap-0.9.20/mod.c:284:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (RSTRING_PTR (str), "#<%s:0x%lx ", c, self); data/ruby-ldap-0.9.20/clientauth.c:227:27: [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). pw_secs = atoi(ctrls[i]->ldctl_value.bv_val); data/ruby-ldap-0.9.20/clientauth.c:551:12: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char buf[512] = ""; data/ruby-ldap-0.9.20/conn.c:91:7: [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 (chost, "localhost"); data/ruby-ldap-0.9.20/conn.c:148:7: [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 (chost, "localhost"); data/ruby-ldap-0.9.20/misc.c:116: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 (copy_ctl, orig_ctl, (size_t) sizeof (LDAPControl)); data/ruby-ldap-0.9.20/rbldap.h:38: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(var, RSTRING_PTR(val), RSTRING_LEN(val) + 1); \ data/ruby-ldap-0.9.20/sslconn.c:50:7: [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 (chost, "localhost"); data/ruby-ldap-0.9.20/sslconn.c:147:7: [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 (chost, "localhost"); data/ruby-ldap-0.9.20/sslconn.c:217:7: [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 (chost, "localhost"); data/ruby-ldap-0.9.20/conn.c:90: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). chost = ALLOCA_N (char, strlen ("localhost") + 1); data/ruby-ldap-0.9.20/conn.c:147: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). chost = ALLOCA_N (char, strlen ("localhost") + 1); data/ruby-ldap-0.9.20/entry.c:305:24: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). str = rb_str_new (0, strlen (c) + 10 + 16 + 1); /* 10:tags 16:addr 1:nul */ data/ruby-ldap-0.9.20/entry.c:309:23: [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). RSTRING(str)->len = strlen (RSTRING_PTR (str)); data/ruby-ldap-0.9.20/entry.c:311:23: [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). rb_str_set_len(str, strlen (RSTRING_PTR (str))); data/ruby-ldap-0.9.20/mod.c:57:32: [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). mod->mod_type = ALLOC_N(char,strlen(mod_type) + 1); data/ruby-ldap-0.9.20/mod.c:89:32: [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). mod->mod_type = ALLOC_N(char,strlen(mod_type) + 1); data/ruby-ldap-0.9.20/mod.c:283:24: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). str = rb_str_new (0, strlen (c) + 10 + 16 + 1); /* 10:tags 16:addr 1:nul */ data/ruby-ldap-0.9.20/mod.c:287:23: [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). RSTRING(str)->len = strlen (RSTRING_PTR (str)); data/ruby-ldap-0.9.20/mod.c:289:23: [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). rb_str_set_len(str, strlen (RSTRING_PTR (str))); data/ruby-ldap-0.9.20/saslconn.c:78:30: [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). interact->len = strlen(dflt); data/ruby-ldap-0.9.20/sslconn.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). chost = ALLOCA_N (char, strlen ("localhost") + 1); data/ruby-ldap-0.9.20/sslconn.c:146: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). chost = ALLOCA_N (char, strlen ("localhost") + 1); data/ruby-ldap-0.9.20/sslconn.c:216: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). chost = ALLOCA_N (char, strlen ("localhost") + 1); ANALYSIS SUMMARY: Hits = 28 Lines analyzed = 5557 in approximately 0.12 seconds (44707 lines/second) Physical Source Lines of Code (SLOC) = 4099 Hits@level = [0] 13 [1] 14 [2] 9 [3] 0 [4] 5 [5] 0 Hits@level+ = [0+] 41 [1+] 28 [2+] 14 [3+] 5 [4+] 5 [5+] 0 Hits/KSLOC@level+ = [0+] 10.0024 [1+] 6.83093 [2+] 3.41547 [3+] 1.21981 [4+] 1.21981 [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.