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/lsmount-0.2.4/src/ansicodes.h Examining data/lsmount-0.2.4/src/helper.c Examining data/lsmount-0.2.4/src/helper.h Examining data/lsmount-0.2.4/src/lsmcolors.c Examining data/lsmount-0.2.4/src/lsmcolors.h Examining data/lsmount-0.2.4/src/lsmgrid.c Examining data/lsmount-0.2.4/src/lsmgrid.h Examining data/lsmount-0.2.4/src/lsmount.c Examining data/lsmount-0.2.4/src/lsmount.h Examining data/lsmount-0.2.4/src/options.c Examining data/lsmount-0.2.4/src/options.h FINAL RESULTS: data/lsmount-0.2.4/src/lsmgrid.c:96:23: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. if(use_color == 1) { printf(ANSI_ESC_RESET); } data/lsmount-0.2.4/src/lsmount.c:55:6: [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(conf_file1, R_OK)) { readconffile(conf_file1); } data/lsmount-0.2.4/src/lsmount.c:56:6: [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(conf_file2, R_OK)) { readconffile(conf_file2); } data/lsmount-0.2.4/src/lsmgrid.c:131:24: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. char* resolvBuf = realpath(elem_of_line, NULL); data/lsmount-0.2.4/src/options.c:40:15: [3] (buffer) getopt_long: 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_long(argc, argv, "aAcCdDf:FhHlLs:SuUvVx:X", data/lsmount-0.2.4/src/helper.c:27:17: [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* stream = fopen(file, "r"); data/lsmount-0.2.4/src/helper.c:62: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[2]; // buffer for snprintf data/lsmount-0.2.4/src/helper.c:44:12: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while( (c=fgetc(stream)) != EOF ) { data/lsmount-0.2.4/src/helper.c:47: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). if( (size_t)filebuf_size == (size_t)strlen(filebuf)+1) { data/lsmount-0.2.4/src/helper.c:50:5: [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(filebuf)+(size_t)filebuf_size // double size data/lsmount-0.2.4/src/helper.c:58:20: [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). filebuf_size = strlen(filebuf)+(size_t)filebuf_size; data/lsmount-0.2.4/src/helper.c:67:13: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. filebuf = strncat(filebuf, buf, 1); // write char to filebuf data/lsmount-0.2.4/src/helper.c:72:53: [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* shrk_filebuf = realloc(filebuf, sizeof(char)*strlen(filebuf)+1); data/lsmount-0.2.4/src/helper.c:79:18: [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). filebuf_size = strlen(filebuf)+(size_t)filebuf_size; data/lsmount-0.2.4/src/helper.c:93: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). while(i<=strlen(buf)) { data/lsmount-0.2.4/src/lsmgrid.c:78:25: [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). column_length[c] - strlen(grid->elem[r*cols+c].value); data/lsmount-0.2.4/src/lsmgrid.c:105: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(grid->elem[r*cols+c].value)>column_length[c]) { data/lsmount-0.2.4/src/lsmgrid.c:106: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). column_length[c] = strlen(grid->elem[r*cols+c].value); ANALYSIS SUMMARY: Hits = 18 Lines analyzed = 917 in approximately 0.05 seconds (18663 lines/second) Physical Source Lines of Code (SLOC) = 800 Hits@level = [0] 34 [1] 11 [2] 2 [3] 2 [4] 3 [5] 0 Hits@level+ = [0+] 52 [1+] 18 [2+] 7 [3+] 5 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 65 [1+] 22.5 [2+] 8.75 [3+] 6.25 [4+] 3.75 [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.