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/privbind-1.2/stub.h Examining data/privbind-1.2/libprivbind.c Examining data/privbind-1.2/main.c Examining data/privbind-1.2/ipc.h Examining data/privbind-1.2/test.c FINAL RESULTS: data/privbind-1.2/main.c:215:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf( newpreload, "%s:%s", options.libname, ldpreload ); data/privbind-1.2/main.c:234:5: [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(new_argv[0], new_argv); data/privbind-1.2/main.c:86:17: [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, "+n:u:g:l:w:h" ))!=-1 ) { data/privbind-1.2/main.c:205:21: [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 *ldpreload=getenv("LD_PRELOAD"); data/privbind-1.2/test.c:63:17: [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, "+n:w:p:hP:T:" ))!=-1 ) { data/privbind-1.2/libprivbind.c:117:4: [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[CMSG_SPACE(sizeof(int))]; data/privbind-1.2/main.c:89:30: [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). options.numbinds=atoi(optarg); data/privbind-1.2/main.c:106:33: [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). options.uid=atoi(optarg); data/privbind-1.2/main.c:142:26: [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). options.wait=atoi(optarg); data/privbind-1.2/main.c:267: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. char buf[CMSG_SPACE(sizeof(int))]; data/privbind-1.2/test.c:66:30: [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). options.numbinds=atoi(optarg); data/privbind-1.2/test.c:69:26: [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). options.wait=atoi(optarg); data/privbind-1.2/test.c:72:26: [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). options.port=atoi(optarg); data/privbind-1.2/test.c:81:31: [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). options.processes=atoi(optarg); data/privbind-1.2/test.c:84:29: [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). options.threads=atoi(optarg); data/privbind-1.2/main.c:209: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). char *newpreload=malloc(strlen(ldpreload)+strlen(options.libname)+2); /* One extra for the ":", another for the NULL */ data/privbind-1.2/main.c:209: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). char *newpreload=malloc(strlen(ldpreload)+strlen(options.libname)+2); /* One extra for the ":", another for the NULL */ ANALYSIS SUMMARY: Hits = 17 Lines analyzed = 901 in approximately 0.05 seconds (18436 lines/second) Physical Source Lines of Code (SLOC) = 629 Hits@level = [0] 41 [1] 2 [2] 10 [3] 3 [4] 2 [5] 0 Hits@level+ = [0+] 58 [1+] 17 [2+] 15 [3+] 5 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 92.2099 [1+] 27.027 [2+] 23.8474 [3+] 7.94913 [4+] 3.17965 [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.