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/mod-mono-3.8/src/mono-io-portability.c Examining data/mod-mono-3.8/src/mod_mono.c Examining data/mod-mono-3.8/src/mono-io-portability.h Examining data/mod-mono-3.8/src/glib_compat.h Examining data/mod-mono-3.8/src/mod_mono.h Examining data/mod-mono-3.8/src/glib_compat.c FINAL RESULTS: data/mod-mono-3.8/src/mod_mono.c:1712:6: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. if (chmod (wapidir, 0700) != 0 && (errno == EPERM || errno == EACCES)) { data/mod-mono-3.8/src/glib_compat.c:197:9: [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 (res, str_array [0]); data/mod-mono-3.8/src/glib_compat.c:200:25: [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 (res, separator); data/mod-mono-3.8/src/glib_compat.c:201:17: [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 (res, str_array [i]); data/mod-mono-3.8/src/mod_mono.c:1421:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (arg, "%s=%s", name, value); data/mod-mono-3.8/src/mod_mono.c:1703:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (path, "%s:%s", serverdir, tmp); data/mod-mono-3.8/src/mod_mono.c:1710:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf (wapidir, "%s/%s", config->wapidir, ".wapi"); data/mod-mono-3.8/src/mod_mono.c:1813:2: [4] (shell) execv: 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. execv (argv [0], argv); data/mod-mono-3.8/src/mono-io-portability.c:86:6: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. access (new_pathname, F_OK) == 0) { data/mod-mono-3.8/src/mono-io-portability.c:109:6: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. access (new_pathname, F_OK) == 0) { data/mod-mono-3.8/src/mono-io-portability.c:251:7: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. access (new_pathname, F_OK) == 0) || data/mod-mono-3.8/src/mod_mono.c:217:15: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char *name = getenv ("MOD_MONO_LOCKING_MECHANISM"); data/mod-mono-3.8/src/mod_mono.c:1672:8: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. tmp = getenv ("PATH"); data/mod-mono-3.8/src/mod_mono.c:2307:8: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if (!getenv ("MOD_MONO_LOCKING_MECHANISM")) { data/mod-mono-3.8/src/mod_mono.c:77: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 uri[URI_LIST_ITEM_SIZE]; data/mod-mono-3.8/src/mod_mono.c:592: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 num [8]; data/mod-mono-3.8/src/mod_mono.c:663: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 (config->servers, servers, sizeof (xsp_data) * config->nservers); data/mod-mono-3.8/src/mod_mono.c:665: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 (&config->servers [config->nservers], server, sizeof (xsp_data)); data/mod-mono-3.8/src/mod_mono.c:802: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 (base_module->servers, base_config, sizeof (xsp_data) * base_module->nservers); data/mod-mono-3.8/src/mod_mono.c:803: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 (&base_module->servers [base_module->nservers], new_config, new_module->nservers * sizeof (xsp_data)); data/mod-mono-3.8/src/mod_mono.c:1335: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 (unix_address.sun_path, fn, strlen (fn) + 1); data/mod-mono-3.8/src/mod_mono.c:1510:8: [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). fd = open ("/dev/null", O_WRONLY); data/mod-mono-3.8/src/mod_mono.c:1525: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 *argv [MAXARGS]; data/mod-mono-3.8/src/mod_mono.c:1890: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 (buffer, &le, sizeof (uint32_t)); data/mod-mono-3.8/src/mod_mono.c:1893: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 (buffer, str, tmp); data/mod-mono-3.8/src/mod_mono.c:1964: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 (countLocation, &count, sizeof (int32_t)); data/mod-mono-3.8/src/mod_mono.c:1967: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 (sizeLocation, &size, sizeof (int32_t)); data/mod-mono-3.8/src/mod_mono.c:2055: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 (ptr, &i, sizeof (i)); data/mod-mono-3.8/src/mod_mono.c:2069: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 (ptr, &i, sizeof (i)); data/mod-mono-3.8/src/mod_mono.c:2078: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 (ptr, &i, sizeof (i)); data/mod-mono-3.8/src/mod_mono.c:2120: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 (list [i].uri, r->uri, uri_len); data/mod-mono-3.8/src/mod_mono.c:2130: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 (&list [i].uri [uri_len + 1], r->args, args_len); data/mod-mono-3.8/src/glib_compat.c:20:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (retval, str, n)[n] = 0; data/mod-mono-3.8/src/glib_compat.c:47:22: [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). int delimiter_len = strlen (delimiter); data/mod-mono-3.8/src/glib_compat.c:182: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). slen = strlen (separator); data/mod-mono-3.8/src/glib_compat.c:188: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). len += strlen (str_array [i]); data/mod-mono-3.8/src/mod_mono.c:224:52: [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 (!strncasecmp (name, lockMechanisms [i].name, strlen (lockMechanisms [i].name))) { data/mod-mono-3.8/src/mod_mono.c:536:15: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). old_umask = umask (0077); data/mod-mono-3.8/src/mod_mono.c:538:3: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask (old_umask); data/mod-mono-3.8/src/mod_mono.c:857:51: [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). request_send_response_from_memory (r, byteArray, strlen (byteArray), 0); data/mod-mono-3.8/src/mod_mono.c:1050: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). len = strlen (name); data/mod-mono-3.8/src/mod_mono.c:1054: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). len = strlen (value); data/mod-mono-3.8/src/mod_mono.c:1335: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). memcpy (unix_address.sun_path, fn, strlen (fn) + 1); data/mod-mono-3.8/src/mod_mono.c:1406:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (result, filepath, sep - filepath); data/mod-mono-3.8/src/mod_mono.c:1420: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). arg = apr_pcalloc (pool, strlen (name) + strlen (value) + 2); data/mod-mono-3.8/src/mod_mono.c:1420:43: [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). arg = apr_pcalloc (pool, strlen (name) + strlen (value) + 2); data/mod-mono-3.8/src/mod_mono.c:1650:3: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask (0077); data/mod-mono-3.8/src/mod_mono.c:1658:3: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask (uval); data/mod-mono-3.8/src/mod_mono.c:1702: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). path = apr_pcalloc (pool, strlen (tmp) + strlen (serverdir) + 2); data/mod-mono-3.8/src/mod_mono.c:1702:43: [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). path = apr_pcalloc (pool, strlen (tmp) + strlen (serverdir) + 2); data/mod-mono-3.8/src/mod_mono.c:1709: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). wapidir = apr_pcalloc (pool, strlen (config->wapidir) + 5 + 2); data/mod-mono-3.8/src/mod_mono.c:1883: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). tmp = strlen (str); data/mod-mono-3.8/src/mod_mono.c:1918: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). size += strlen (t_elt->key); data/mod-mono-3.8/src/mod_mono.c:1919: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). size += strlen (t_elt->val); data/mod-mono-3.8/src/mod_mono.c:1996:43: [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). info.method_len = ((r->method != NULL) ? strlen (r->method) : 0); data/mod-mono-3.8/src/mod_mono.c:1999:79: [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). info.server_hostname_len = ((s->is_virtual && s->server_hostname != NULL) ? strlen (s->server_hostname) : 0); data/mod-mono-3.8/src/mod_mono.c:2006:37: [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). info.uri_len = ((r->uri != NULL) ? strlen (r->uri) : 0); data/mod-mono-3.8/src/mod_mono.c:2009:39: [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). info.args_len = ((r->args != NULL) ? strlen (r->args) : 0); data/mod-mono-3.8/src/mod_mono.c:2012:47: [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). info.protocol_len = ((r->protocol != NULL) ? strlen (r->protocol) : 0); data/mod-mono-3.8/src/mod_mono.c:2015:22: [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). info.local_ip_len = strlen (r->connection->local_ip); data/mod-mono-3.8/src/mod_mono.c:2020: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). info.remote_ip_len = strlen (r->connection->client_ip); data/mod-mono-3.8/src/mod_mono.c:2022: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). info.remote_ip_len = strlen (r->connection->remote_ip); data/mod-mono-3.8/src/mod_mono.c:2029: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). info.remote_name_len = strlen (info.remote_name); data/mod-mono-3.8/src/mod_mono.c:2038: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). info.filename_len = strlen (r->filename); data/mod-mono-3.8/src/mod_mono.c:2117: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). uri_len = strlen (r->uri); data/mod-mono-3.8/src/mod_mono.c:2125: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). args_len = strlen (r->args); data/mod-mono-3.8/src/mono-io-portability.c:96: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). int len = strlen (new_pathname); data/mod-mono-3.8/src/mono-io-portability.c:103: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). len = strlen (new_pathname); ANALYSIS SUMMARY: Hits = 68 Lines analyzed = 3892 in approximately 0.12 seconds (32760 lines/second) Physical Source Lines of Code (SLOC) = 3127 Hits@level = [0] 2 [1] 36 [2] 18 [3] 3 [4] 10 [5] 1 Hits@level+ = [0+] 70 [1+] 68 [2+] 32 [3+] 14 [4+] 11 [5+] 1 Hits/KSLOC@level+ = [0+] 22.3857 [1+] 21.7461 [2+] 10.2335 [3+] 4.47713 [4+] 3.51775 [5+] 0.319795 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.