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/xmlindent-0.2.17/buffer.c Examining data/xmlindent-0.2.17/buffer.h Examining data/xmlindent-0.2.17/error.c Examining data/xmlindent-0.2.17/error.h Examining data/xmlindent-0.2.17/indent.h Examining data/xmlindent-0.2.17/main.c Examining data/xmlindent-0.2.17/version.h Examining data/xmlindent-0.2.17/indent.c FINAL RESULTS: data/xmlindent-0.2.17/error.c:29:5: [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. vfprintf(stderr, format, args); data/xmlindent-0.2.17/main.c:63:2: [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(input_filename, filename); data/xmlindent-0.2.17/main.c:68:6: [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(backup_filename, input_filename); data/xmlindent-0.2.17/main.c:72:6: [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(output_filename, input_filename); data/xmlindent-0.2.17/main.c:73:6: [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(input_filename, backup_filename); data/xmlindent-0.2.17/main.c:156:6: [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(output_filename, optarg); data/xmlindent-0.2.17/main.c:129:18: [3] (buffer) getopt: 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. int arg_index = getopt(argc, argv, "hfi:l:o:n:tvw"); data/xmlindent-0.2.17/main.c:56: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 input_filename[FILENAME_MAX]; data/xmlindent-0.2.17/main.c:67:6: [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 backup_filename[FILENAME_MAX]; data/xmlindent-0.2.17/main.c:78:10: [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). input = fopen(input_filename, "r"); data/xmlindent-0.2.17/main.c:89:11: [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). output = fopen(output_filename, "w"); data/xmlindent-0.2.17/main.c:138:31: [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). opts->num_indent_chars = atoi(optarg); data/xmlindent-0.2.17/main.c:142: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). opts->max_columns = atoi(optarg); data/xmlindent-0.2.17/main.c:176: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 output_filename[FILENAME_MAX]; data/xmlindent-0.2.17/buffer.c:82:21: [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). for (i = 0; i < strlen(text); i++) { data/xmlindent-0.2.17/indent.c:442: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). int len = strlen(yytext); data/xmlindent-0.2.17/main.c:69:6: [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(backup_filename, "~"); data/xmlindent-0.2.17/main.c:77: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(input_filename) > 0) { data/xmlindent-0.2.17/main.c:88: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(output_filename) > 0) { ANALYSIS SUMMARY: Hits = 19 Lines analyzed = 996 in approximately 0.05 seconds (20450 lines/second) Physical Source Lines of Code (SLOC) = 622 Hits@level = [0] 14 [1] 5 [2] 7 [3] 1 [4] 6 [5] 0 Hits@level+ = [0+] 33 [1+] 19 [2+] 14 [3+] 7 [4+] 6 [5+] 0 Hits/KSLOC@level+ = [0+] 53.0547 [1+] 30.5466 [2+] 22.508 [3+] 11.254 [4+] 9.6463 [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.