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/ed-1.16/main.c Examining data/ed-1.16/ed.h Examining data/ed-1.16/main_loop.c Examining data/ed-1.16/signal.c Examining data/ed-1.16/buffer.c Examining data/ed-1.16/global.c Examining data/ed-1.16/carg_parser.h Examining data/ed-1.16/carg_parser.c Examining data/ed-1.16/io.c Examining data/ed-1.16/regex.c FINAL RESULTS: data/ed-1.16/io.c:275:31: [4] (shell) popen: 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. if( *filename == '!' ) fp = popen( filename + 1, "r" ); data/ed-1.16/io.c:333:31: [4] (shell) popen: 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. if( *filename == '!' ) fp = popen( filename + 1, "w" ); data/ed-1.16/main_loop.c:617:19: [4] (shell) system: 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. if( system( fnp + 1 ) < 0 ) data/ed-1.16/signal.c:53:24: [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 * const s = getenv( "HOME" ); data/ed-1.16/buffer.c:314: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( buf + size, s, bp->len ); data/ed-1.16/buffer.c:382:9: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). sfp = tmpfile(); data/ed-1.16/carg_parser.c:160: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 code_str[2]; data/ed-1.16/io.c:123: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( buf, *ibufpp, len ); data/ed-1.16/io.c:133: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( buf + len, s, len2 ); data/ed-1.16/io.c:276:13: [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). else fp = fopen( strip_escapes( filename ), "r" ); data/ed-1.16/io.c:334:13: [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). else fp = fopen( strip_escapes( filename ), mode ); data/ed-1.16/main_loop.c:31:8: [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 errmsg[80] = ""; /* error message buffer */ data/ed-1.16/main_loop.c:44: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( buf, s, len + 1 ); data/ed-1.16/main_loop.c:61: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( buf, s, len + 1 ); data/ed-1.16/main_loop.c:122: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( buf, shcmd, shcmdlen ); /* bufsz >= shcmdlen */ data/ed-1.16/main_loop.c:135:7: [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( buf + i, p, len ); data/ed-1.16/main_loop.c:146: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( shcmd, buf, i ); data/ed-1.16/main_loop.c:677:9: [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( buf, *ibufpp, len + 1 ); data/ed-1.16/regex.c:97: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( buf, *ibufpp, len ); data/ed-1.16/regex.c:134: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 buf[80]; data/ed-1.16/regex.c:320:9: [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( *txtbufp + offset, txt, i ); offset += i; data/ed-1.16/regex.c:330:9: [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( *txtbufp + offset, txt, i ); offset += i; data/ed-1.16/regex.c:342: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( *txtbufp + offset, txt, i ); /* tail copy */ data/ed-1.16/regex.c:343: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( *txtbufp + offset + i, "\n", 2 ); data/ed-1.16/signal.c:60:9: [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( hup, s, len ); data/ed-1.16/signal.c:62:9: [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( hup + len + need_slash, hb, sizeof hb ); data/ed-1.16/carg_parser.c:38: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). const int len = strlen( argument ); data/ed-1.16/carg_parser.c:50:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy( p->argument, argument, len + 1 ); data/ed-1.16/carg_parser.c:58: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). const int len = strlen( msg ); data/ed-1.16/carg_parser.c:62:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy( ap->error + ap->error_size, msg, len + 1 ); data/ed-1.16/carg_parser.c:92: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( options[i].name ) == len ) /* Exact match found */ data/ed-1.16/io.c:158:19: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). const int c = getchar(); data/ed-1.16/io.c:200:9: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = getc( fp ); if( c == EOF ) break; data/ed-1.16/main_loop.c:42: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). const int len = strlen( s ); data/ed-1.16/main_loop.c:51:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy( errmsg, msg, sizeof errmsg ); data/ed-1.16/main_loop.c:59: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). const int len = strlen( s ); data/ed-1.16/main_loop.c:133: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). len = strlen( p ); data/ed-1.16/signal.c:54:29: [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). const int len = ( s ? strlen( s ) : 0 ); data/ed-1.16/signal.c:256: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). const int len = strlen( p ); ANALYSIS SUMMARY: Hits = 39 Lines analyzed = 3194 in approximately 0.37 seconds (8736 lines/second) Physical Source Lines of Code (SLOC) = 2503 Hits@level = [0] 20 [1] 13 [2] 22 [3] 1 [4] 3 [5] 0 Hits@level+ = [0+] 59 [1+] 39 [2+] 26 [3+] 4 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 23.5717 [1+] 15.5813 [2+] 10.3875 [3+] 1.59808 [4+] 1.19856 [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.