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/findent-3.1.7/src/builtlexer.cpp Examining data/findent-3.1.7/src/functions.h Examining data/findent-3.1.7/src/findent_types.h Examining data/findent-3.1.7/src/findent.cpp Examining data/findent-3.1.7/src/docs.h Examining data/findent-3.1.7/src/line_prep.h Examining data/findent-3.1.7/src/fortranline.cpp Examining data/findent-3.1.7/src/parser.hpp Examining data/findent-3.1.7/src/findentrun.cpp Examining data/findent-3.1.7/src/globals.h Examining data/findent-3.1.7/src/flags.h Examining data/findent-3.1.7/src/builtparser.cpp Examining data/findent-3.1.7/src/fortran.h Examining data/findent-3.1.7/src/findentclass.h Examining data/findent-3.1.7/src/fortran.cpp Examining data/findent-3.1.7/src/builtparser.hpp Examining data/findent-3.1.7/src/debug.h Examining data/findent-3.1.7/src/debug.cpp Examining data/findent-3.1.7/src/fixed.cpp Examining data/findent-3.1.7/src/simpleostream.h Examining data/findent-3.1.7/src/version.h Examining data/findent-3.1.7/src/functions.cpp Examining data/findent-3.1.7/src/flags.cpp Examining data/findent-3.1.7/src/pre_analyzer.h Examining data/findent-3.1.7/src/simpleostream.cpp Examining data/findent-3.1.7/src/lexer.h Examining data/findent-3.1.7/src/mylexer.cpp Examining data/findent-3.1.7/src/findentrun.h Examining data/findent-3.1.7/src/free.h Examining data/findent-3.1.7/src/findent.h Examining data/findent-3.1.7/src/myparser.cpp Examining data/findent-3.1.7/src/docs.cpp Examining data/findent-3.1.7/src/pre_analyzer.cpp Examining data/findent-3.1.7/src/findentclass.cpp Examining data/findent-3.1.7/src/line_prep.cpp Examining data/findent-3.1.7/src/free.cpp Examining data/findent-3.1.7/src/prop.h Examining data/findent-3.1.7/src/prop.cpp Examining data/findent-3.1.7/src/fixed.h Examining data/findent-3.1.7/src/globals.cpp Examining data/findent-3.1.7/src/fortranline.h FINAL RESULTS: data/findent-3.1.7/src/builtparser.cpp:1082:21: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. # define YYFPRINTF fprintf data/findent-3.1.7/src/flags.cpp:70:20: [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 *envopts = getenv("FINDENT_FLAGS"); data/findent-3.1.7/src/flags.cpp:258:13: [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((c=getopt_long(nflags,allflags, data/findent-3.1.7/src/builtparser.cpp:1332: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 const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; data/findent-3.1.7/src/builtparser.cpp:1527: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 yymsgbuf[128]; data/findent-3.1.7/src/flags.cpp:266: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). associate_indent = atoi(optarg); data/findent-3.1.7/src/flags.cpp:270: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). block_indent = atoi(optarg); // --indent_block=nn data/findent-3.1.7/src/flags.cpp:274: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). case_indent = atoi(optarg); // --indent_case=nn data/findent-3.1.7/src/flags.cpp:281: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). contains_indent = atoi(optarg); data/findent-3.1.7/src/flags.cpp:285: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). do_indent = atoi(optarg); data/findent-3.1.7/src/flags.cpp:289: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). entry_indent = atoi(optarg); // --indent_entry=nn data/findent-3.1.7/src/flags.cpp:293: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). enum_indent = atoi(optarg); // --indent_enum=nn data/findent-3.1.7/src/flags.cpp:297: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). if_indent = atoi(optarg); // --indent_if=nn data/findent-3.1.7/src/flags.cpp:301: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). forall_indent = atoi(optarg); // --indent_forall=nn data/findent-3.1.7/src/flags.cpp:323:22: [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). all_indent = atoi(optarg); data/findent-3.1.7/src/flags.cpp:333:28: [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). start_indent = atoi(optarg); data/findent-3.1.7/src/flags.cpp:339: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). interface_indent = atoi(optarg); // --indent_interface=nn data/findent-3.1.7/src/flags.cpp:346:23: [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). cont_indent = atoi(optarg); data/findent-3.1.7/src/flags.cpp:355:27: [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). label_left = (atoi(optarg) != 0); // --label_left=0/1 data/findent-3.1.7/src/flags.cpp:361: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). input_line_length = atoi(optarg); // --input_line_length=nn data/findent-3.1.7/src/flags.cpp:367: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). module_indent = atoi(optarg); // --indent_module=nn data/findent-3.1.7/src/flags.cpp:371: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). max_indent = atoi(optarg); // --max-indent=nn data/findent-3.1.7/src/flags.cpp:403: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). routine_indent = atoi(optarg); data/findent-3.1.7/src/flags.cpp:418: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). select_indent = atoi(optarg); data/findent-3.1.7/src/flags.cpp:422: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). type_indent = atoi(optarg); // --indent_type=nn data/findent-3.1.7/src/flags.cpp:429: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). where_indent = atoi(optarg); // --indent_where=nn data/findent-3.1.7/src/flags.cpp:433: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). critical_indent = atoi(optarg); // --indent_critical=nn data/findent-3.1.7/src/flags.cpp:437: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). changeteam_indent = atoi(optarg); // --indent_changeteam=nn data/findent-3.1.7/src/flags.cpp:451:28: [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). include_left = (atoi(optarg) != 0); // --include_left=0/1 data/findent-3.1.7/src/flags.cpp:458:27: [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). contains_indent = atoi(optarg); data/findent-3.1.7/src/flags.cpp:475:22: [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). all_indent = atoi(optarg); data/findent-3.1.7/src/flags.cpp:487: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). label_left = (atoi(optarg) != 0); // --label_left=0/1 data/findent-3.1.7/src/flags.cpp:501:28: [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). segment_indent = atoi(optarg); // --indent_segment=nn data/findent-3.1.7/src/flags.cpp:506:10: [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). if (atoi(optarg) == 0) data/findent-3.1.7/src/builtlexer.cpp:2615:14: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ data/findent-3.1.7/src/builtlexer.cpp:4556:37: [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). return yy_scan_bytes( yystr, (int) strlen(yystr) ); data/findent-3.1.7/src/builtparser.cpp:1230:47: [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 yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S))) data/findent-3.1.7/src/flags.cpp:10:36: [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 optargcheck if (!optarg || strlen(optarg)==0) break; data/findent-3.1.7/src/flags.cpp:83:52: [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). allflags = (char**) malloc(sizeof(char*)*(strlen(envflags)+argc)); data/findent-3.1.7/src/flags.cpp:278: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(optarg)>0 && optarg[0] == '-') data/findent-3.1.7/src/flags.cpp:319: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). else if (strlen(optarg)>0 && optarg[0] == '-') // --indent=no/nn data/findent-3.1.7/src/flags.cpp:329:10: [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(optarg)>0 && optarg[0] == 'a') data/findent-3.1.7/src/flags.cpp:343:10: [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(optarg)>0 && (optarg[0] == '-' || !strcmp(optarg,"none"))) data/findent-3.1.7/src/flags.cpp:359:10: [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(optarg)>0) data/findent-3.1.7/src/flags.cpp:362:37: [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). input_format_gnu = (optarg[strlen(optarg)-1] == 'g'); data/findent-3.1.7/src/flags.cpp:441:10: [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(optarg) > 0) data/findent-3.1.7/src/flags.cpp:492: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). if (optarg != 0 && strlen(optarg) > 0) ANALYSIS SUMMARY: Hits = 47 Lines analyzed = 12939 in approximately 0.41 seconds (31715 lines/second) Physical Source Lines of Code (SLOC) = 10124 Hits@level = [0] 2 [1] 13 [2] 31 [3] 2 [4] 1 [5] 0 Hits@level+ = [0+] 49 [1+] 47 [2+] 34 [3+] 3 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 4.83998 [1+] 4.64243 [2+] 3.35836 [3+] 0.296326 [4+] 0.0987752 [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.