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/authbind-2.1.2/authbind.c Examining data/authbind-2.1.2/authbind.h Examining data/authbind-2.1.2/helper.c Examining data/authbind-2.1.2/libauthbind.c FINAL RESULTS: data/authbind-2.1.2/authbind.c:78: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(newpreload,expreload); data/authbind-2.1.2/authbind.c:80:5: [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(newpreload,authbindlib); data/authbind-2.1.2/authbind.c:96: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(argv[1],argv+1); data/authbind-2.1.2/helper.c:66:8: [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. if (!access(file,X_OK)) authorised(); data/authbind-2.1.2/helper.c:138:8: [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. if (!access(fnbuf,X_OK)) authorised(); data/authbind-2.1.2/libauthbind.c:107: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(newval+before,preload+lpreload-after); data/authbind-2.1.2/libauthbind.c:111: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(preload+before,preload+lpreload-after); data/authbind-2.1.2/libauthbind.c:216:5: [4] (shell) execl: 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. execl(HELPER,HELPER,addrarg,portarg,afarg,(char*)0); data/authbind-2.1.2/authbind.c:70:16: [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. authbindlib= getenv(AUTHBINDLIB_VAR); data/authbind-2.1.2/authbind.c:76:19: [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 ((expreload= getenv(PRELOAD_VAR))) { data/authbind-2.1.2/libauthbind.c:75:12: [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. preload= getenv(PRELOAD_VAR); data/authbind-2.1.2/libauthbind.c:76:11: [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. myself= getenv(AUTHBINDLIB_VAR); data/authbind-2.1.2/libauthbind.c:127:11: [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. levels= getenv(AUTHBIND_LEVELS_VAR); data/authbind-2.1.2/authbind.c:50:3: [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[50]; data/authbind-2.1.2/authbind.c:88:5: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(buf,"%ld",depth-1); data/authbind-2.1.2/helper.c:73: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 hex[3], *ep; data/authbind-2.1.2/helper.c:84:3: [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 fnbuf[300]; data/authbind-2.1.2/helper.c:141:3: [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 npbuf[INET_ADDRSTRLEN + INET6_ADDRSTRLEN]; data/authbind-2.1.2/helper.c:154: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 sbuf[addrlen_any*3+1], *sp = sbuf; data/authbind-2.1.2/helper.c:162:13: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sp += sprintf(sp,"%x",val); data/authbind-2.1.2/helper.c:171:9: [2] (misc) fopen: 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). file= fopen(fnbuf,"r"); data/authbind-2.1.2/helper.c:212:11: [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 thaddr[addrlen_any]; data/authbind-2.1.2/helper.c:238:11: [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 minaddr[addrlen_any]; data/authbind-2.1.2/helper.c:239:11: [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 maxaddr[addrlen_any]; data/authbind-2.1.2/libauthbind.c:106: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(newval,preload,before); data/authbind-2.1.2/libauthbind.c:130:14: [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). levelno= atoi(levels); data/authbind-2.1.2/libauthbind.c:133:24: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. if (levelno > 0) sprintf(levels,"%d",levelno); data/authbind-2.1.2/libauthbind.c:147:3: [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 portarg[5], addrarg[33]; data/authbind-2.1.2/libauthbind.c:183:5: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(addrarg,"%08lx", data/authbind-2.1.2/libauthbind.c:190:7: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(addrarg+i*2,"%02x", data/authbind-2.1.2/libauthbind.c:196:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(portarg,"%04x", data/authbind-2.1.2/authbind.c:77: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). newpreload= malloc(strlen(expreload)+strlen(authbindlib)+2); data/authbind-2.1.2/authbind.c:77:42: [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). newpreload= malloc(strlen(expreload)+strlen(authbindlib)+2); data/authbind-2.1.2/authbind.c:79:5: [1] (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). Risk is low because the source is a constant character. strcat(newpreload,":"); data/authbind-2.1.2/helper.c:182: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). nchar == strlen(fnbuf))) { data/authbind-2.1.2/helper.c:210: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). if (nchar != strlen(slash)) data/authbind-2.1.2/helper.c:251: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). nchar == strlen(comma)) { data/authbind-2.1.2/helper.c:256: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). nchar == strlen(comma)) { data/authbind-2.1.2/libauthbind.c:40: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). #define STDERRSTR_STRING(m) write(2,m,strlen(m)) data/authbind-2.1.2/libauthbind.c:79: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). lpreload= strlen(preload); data/authbind-2.1.2/libauthbind.c:80: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). lmyself= strlen(myself); ANALYSIS SUMMARY: Hits = 41 Lines analyzed = 657 in approximately 0.03 seconds (23057 lines/second) Physical Source Lines of Code (SLOC) = 489 Hits@level = [0] 13 [1] 10 [2] 18 [3] 5 [4] 8 [5] 0 Hits@level+ = [0+] 54 [1+] 41 [2+] 31 [3+] 13 [4+] 8 [5+] 0 Hits/KSLOC@level+ = [0+] 110.429 [1+] 83.8446 [2+] 63.3947 [3+] 26.5849 [4+] 16.3599 [5+] 0 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.