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/nss-tls-0~git20200523/nss-tls.c Examining data/nss-tls-0~git20200523/nss-tls.h Examining data/nss-tls-0~git20200523/nss-tlsd.c Examining data/nss-tls-0~git20200523/tlslookup.c FINAL RESULTS: data/nss-tls-0~git20200523/nss-tlsd.c:1005:37: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. ((errno != EEXIST) || (chmod (NSS_TLS_SOCKET_DIR, 0755) < 0))) || data/nss-tls-0~git20200523/nss-tlsd.c:1006:14: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. (chown (NSS_TLS_SOCKET_DIR, uid, gid) < 0) || data/nss-tls-0~git20200523/nss-tls.c:69: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(sun.sun_path, NSS_TLS_SOCKET_PATH); data/nss-tls-0~git20200523/nss-tls.c:85:13: [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(sun.sun_path, NSS_TLS_SOCKET_PATH); data/nss-tls-0~git20200523/nss-tls.c:110: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(sun.sun_path, NSS_TLS_SOCKET_PATH); data/nss-tls-0~git20200523/nss-tlsd.c:198:13: [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 (session->response.cname, res->cname); data/nss-tls-0~git20200523/nss-tlsd.c:378:5: [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 (session->request.name, session->response.cname); data/nss-tls-0~git20200523/nss-tls.c:71: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. dir = getenv("XDG_RUNTIME_DIR"); data/nss-tls-0~git20200523/nss-tlsd.c:287:14: [3] (random) g_random_int_range: 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. id = g_random_int_range (0, nresolvers); data/nss-tls-0~git20200523/nss-tlsd.c:293:18: [3] (random) g_random_int_range: 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. method = g_random_int_range (NSS_TLS_METHOD_MIN, NSS_TLS_METHOD_MAX); data/nss-tls-0~git20200523/nss-tlsd.c:862:42: [3] (buffer) g_get_home_dir: This function is synonymous with 'getenv("HOME")';it returns untrustable input if the environment can beset by an attacker. It 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. user_dir = g_build_filename (g_get_home_dir (), ".config", NULL); data/nss-tls-0~git20200523/nss-tls.c:77:13: [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(sun.sun_path, dir, len); data/nss-tls-0~git20200523/nss-tls.h:29: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 name[NS_MAXDNAME]; data/nss-tls-0~git20200523/nss-tls.h:35: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 cname[NS_MAXDNAME]; data/nss-tls-0~git20200523/nss-tls.h:43: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 *aliases[2]; data/nss-tls-0~git20200523/nss-tls.h:44: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 *addrs[NSS_TLS_ADDRS_MAX + 1]; data/nss-tls-0~git20200523/nss-tlsd.c:62:14: [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 dns[UINT16_MAX]; data/nss-tls-0~git20200523/nss-tlsd.c:193:13: [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 (session->response.addrs, data/nss-tls-0~git20200523/nss-tlsd.c:252:21: [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 unsigned char sbuf[MAX_REQ_SIZE]; data/nss-tls-0~git20200523/nss-tlsd.c:459:13: [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 (&session->response.addrs[session->response.count], data/nss-tls-0~git20200523/nss-tlsd.c:818: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 (resolvers, data/nss-tls-0~git20200523/tlslookup.c:42: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[INET6_ADDRSTRLEN]; data/nss-tls-0~git20200523/nss-tls.c:73:19: [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(dir); data/nss-tls-0~git20200523/nss-tls.c:80:13: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(sun.sun_path + len, data/nss-tls-0~git20200523/nss-tls.c:116:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(data->req.name, name, sizeof(data->req.name)); data/nss-tls-0~git20200523/nss-tlsd.c:229: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). for (i = 0; i < strlen (b64); ++i) { ANALYSIS SUMMARY: Hits = 26 Lines analyzed = 1440 in approximately 0.05 seconds (27024 lines/second) Physical Source Lines of Code (SLOC) = 1115 Hits@level = [0] 2 [1] 4 [2] 11 [3] 4 [4] 5 [5] 2 Hits@level+ = [0+] 28 [1+] 26 [2+] 22 [3+] 11 [4+] 7 [5+] 2 Hits/KSLOC@level+ = [0+] 25.1121 [1+] 23.3184 [2+] 19.7309 [3+] 9.86547 [4+] 6.27803 [5+] 1.79372 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.