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/libflorist-2017/c-posix-signals.c Examining data/libflorist-2017/c-posix.c Examining data/libflorist-2017/libsrc/posix-macros.c Examining data/libflorist-2017/libsrc/posix-macros-sockets.c Examining data/libflorist-2017/lynxos5/pconfig.h Examining data/libflorist-2017/addrinfo.h FINAL RESULTS: data/libflorist-2017/c-posix.c:5995:9: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. GFUNC(chmod,HAVE_chmod); data/libflorist-2017/c-posix.c:5996:9: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. GFUNC(chown,HAVE_chown); data/libflorist-2017/c-posix.c:79:11: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. done = vfprintf(stream, format, arg); data/libflorist-2017/c-posix.c:1699: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(extended_name,type->typename); data/libflorist-2017/c-posix.c:1704: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(extended_name,type->typename); data/libflorist-2017/c-posix.c:5980:9: [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. GFUNC(access,HAVE_access); data/libflorist-2017/c-posix.c:6031:9: [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. GFUNC(execv,HAVE_execv); data/libflorist-2017/c-posix.c:6033:9: [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. GFUNC(execvp,HAVE_execvp); data/libflorist-2017/c-posix.c:6056:9: [4] (misc) getlogin: It's often easy to fool getlogin. Sometimes it does not work at all, because some program messed up the utmp file. Often, it gives only the first 8 characters of the login name. The user currently logged in on the controlling tty of our program need not be the user who started it. Avoid getlogin() for security-related purposes (CWE-807). Use getpwuid(geteuid()) and extract the desired information instead. GFUNC(getlogin,HAVE_getlogin); data/libflorist-2017/c-posix.c:6050:9: [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. GFUNC(getenv,HAVE_getenv); data/libflorist-2017/c-posix-signals.c:400:16: [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). if (! (fp = fopen (GENDIR "/posix-implementation-ok_signals.ads", "w"))) { data/libflorist-2017/c-posix.c:390:1: [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 error_message[128]; data/libflorist-2017/c-posix.c:774: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 d_name[1]; data/libflorist-2017/c-posix.c:1069: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 sysname [257]; data/libflorist-2017/c-posix.c:1070: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 nodename [257]; data/libflorist-2017/c-posix.c:1071: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 release [257]; data/libflorist-2017/c-posix.c:1072: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 version [257]; data/libflorist-2017/c-posix.c:1073: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 machine [257]; data/libflorist-2017/c-posix.c:1103: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. typedef char in_addr_t[4]; data/libflorist-2017/c-posix.c:1109: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. typedef char in_addr_t[4]; data/libflorist-2017/c-posix.c:1124: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 sa_data [14]; data/libflorist-2017/c-posix.c:1137: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 sun_path [100]; data/libflorist-2017/c-posix.c:1152: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 sin_zero [8]; data/libflorist-2017/c-posix.c:1248: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 ip_opts[40]; data/libflorist-2017/c-posix.c:1654: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(tmp->typename,name,count+1); data/libflorist-2017/c-posix.c:1664: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(tmp->comps,comps,(count+1)*sizeof(component_t)); data/libflorist-2017/c-posix.c:1680: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 extended_name[128]; data/libflorist-2017/c-posix.c:1698:5: [2] (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). Risk is low because the source is a constant string. strcpy(extended_name,"struct_"); data/libflorist-2017/c-posix.c:2500:15: [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). if (! (fp = fopen (GENDIR "/posix-options.ads", "w"))) { data/libflorist-2017/c-posix.c:2745:15: [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). if (! (fp = fopen (GENDIR "/posix-limits.ads", "w"))) { data/libflorist-2017/c-posix.c:3107:15: [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). if (! (fp = fopen (GENDIR "/posix.ads", "w"))) { data/libflorist-2017/c-posix.c:4226:18: [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 c[4]; data/libflorist-2017/c-posix.c:4326:15: [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). if (! (fp = fopen (GENDIR "/posix-c.ads", "w"))) { data/libflorist-2017/c-posix.c:6091:9: [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). GFUNC(open,HAVE_open); data/libflorist-2017/libsrc/posix-macros.c:220:10: [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). return open (path, oflag, mode); data/libflorist-2017/c-posix.c:1652: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). count = strlen(name); data/libflorist-2017/c-posix.c:1695: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). if (strlen(type->typename)>=sizeof(extended_name)) { data/libflorist-2017/c-posix.c:1701: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). if (strlen(type->typename)>=sizeof(extended_name)) { data/libflorist-2017/c-posix.c:1828:17: [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 namelen = strlen(pkgname); data/libflorist-2017/c-posix.c:2026: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). typename [strlen (typename) - 1] == ')') data/libflorist-2017/c-posix.c:2048: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(name); data/libflorist-2017/c-posix.c:2184: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). if (strlen(name) > 20) { data/libflorist-2017/c-posix.c:2201: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). if (strlen(name) > 20) { data/libflorist-2017/c-posix.c:2231:7: [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 (strlen(name) > 20) { data/libflorist-2017/c-posix.c:2255: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). if (strlen(name) > 20) { data/libflorist-2017/c-posix.c:2272: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). if (strlen(name) > 20) { data/libflorist-2017/c-posix.c:2310: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). if (strlen(name) > 20) { data/libflorist-2017/c-posix.c:2327: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). if (strlen(name) > 20) { data/libflorist-2017/c-posix.c:2337: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). if (strlen(name) > 20) { data/libflorist-2017/c-posix.c:2359: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). if (strlen(name) > 20) { data/libflorist-2017/c-posix.c:2376: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). if (strlen(name) > 20) { data/libflorist-2017/c-posix.c:2386: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). if (strlen(name) > 20) { data/libflorist-2017/c-posix.c:6169:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). GFUNC(read,HAVE_read); data/libflorist-2017/c-posix.c:6265:9: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). GFUNC(umask,HAVE_umask); ANALYSIS SUMMARY: Hits = 54 Lines analyzed = 8781 in approximately 0.35 seconds (24983 lines/second) Physical Source Lines of Code (SLOC) = 7200 Hits@level = [0] 258 [1] 19 [2] 25 [3] 1 [4] 7 [5] 2 Hits@level+ = [0+] 312 [1+] 54 [2+] 35 [3+] 10 [4+] 9 [5+] 2 Hits/KSLOC@level+ = [0+] 43.3333 [1+] 7.5 [2+] 4.86111 [3+] 1.38889 [4+] 1.25 [5+] 0.277778 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.