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/ucspi-unix-1.0/trypeercred.c Examining data/ucspi-unix-1.0/trywaitp.c Examining data/ucspi-unix-1.0/env.c Examining data/ucspi-unix-1.0/utoa.c Examining data/ucspi-unix-1.0/unixclient.c Examining data/ucspi-unix-1.0/unixserver.c FINAL RESULTS: data/ucspi-unix-1.0/unixserver.c:193:6: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. if(chown(opt_socket, opt_socket_uid, opt_socket_gid) == -1) data/ucspi-unix-1.0/unixserver.c:195:19: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. if(opt_perms && chmod(opt_socket, opt_perms) == -1) data/ucspi-unix-1.0/unixclient.c:39: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(saddr->sun_path, opt_socket); data/ucspi-unix-1.0/unixclient.c:76:3: [4] (shell) execvp: 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. execvp(command_argv[0], command_argv); data/ucspi-unix-1.0/unixserver.c:184: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(saddr->sun_path, opt_socket); data/ucspi-unix-1.0/unixserver.c:223:3: [4] (shell) execvp: 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. execvp(command_argv[0], command_argv); data/ucspi-unix-1.0/unixserver.c:131:16: [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((opt = getopt(argc, argv, "dDqQvc:u:g:Ub:B:m:o:r:Op:")) != EOF) { data/ucspi-unix-1.0/unixserver.c:145: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. use_uid(getenv("UID")); data/ucspi-unix-1.0/unixserver.c:146: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. use_gid(getenv("GID")); data/ucspi-unix-1.0/unixserver.c:151:22: [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. use_socket_uid(getenv("SOCKET_UID")); data/ucspi-unix-1.0/unixserver.c:152:22: [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. use_socket_gid(getenv("SOCKET_GID")); data/ucspi-unix-1.0/utoa.c:4:10: [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[LONGLEN]; data/ucspi-unix-1.0/unixclient.c:16:11: [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 ((ptr)->sun_path)) data/ucspi-unix-1.0/unixclient.c:36: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). size = sizeof(struct sockaddr_un) + strlen(opt_socket)+1; data/ucspi-unix-1.0/unixserver.c:17:11: [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 ((ptr)->sun_path)) data/ucspi-unix-1.0/unixserver.c:182:11: [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(opt_socket) + 1); data/ucspi-unix-1.0/unixserver.c:189:15: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). old_umask = umask(opt_umask); data/ucspi-unix-1.0/unixserver.c:192:3: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(old_umask); data/ucspi-unix-1.0/unixserver.c:209: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). ssize_t len = strlen(opt_banner); ANALYSIS SUMMARY: Hits = 19 Lines analyzed = 452 in approximately 0.02 seconds (19322 lines/second) Physical Source Lines of Code (SLOC) = 412 Hits@level = [0] 7 [1] 7 [2] 1 [3] 5 [4] 4 [5] 2 Hits@level+ = [0+] 26 [1+] 19 [2+] 12 [3+] 11 [4+] 6 [5+] 2 Hits/KSLOC@level+ = [0+] 63.1068 [1+] 46.1165 [2+] 29.1262 [3+] 26.699 [4+] 14.5631 [5+] 4.85437 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.