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/editorconfig-core-0.12.1/include/editorconfig/editorconfig_handle.h Examining data/editorconfig-core-0.12.1/include/editorconfig/editorconfig.h Examining data/editorconfig-core-0.12.1/src/bin/main.c Examining data/editorconfig-core-0.12.1/src/lib/ec_glob.c Examining data/editorconfig-core-0.12.1/src/lib/ec_glob.h Examining data/editorconfig-core-0.12.1/src/lib/editorconfig.c Examining data/editorconfig-core-0.12.1/src/lib/editorconfig.h Examining data/editorconfig-core-0.12.1/src/lib/editorconfig_handle.c Examining data/editorconfig-core-0.12.1/src/lib/editorconfig_handle.h Examining data/editorconfig-core-0.12.1/src/lib/global.h Examining data/editorconfig-core-0.12.1/src/lib/ini.c Examining data/editorconfig-core-0.12.1/src/lib/ini.h Examining data/editorconfig-core-0.12.1/src/lib/misc.c Examining data/editorconfig-core-0.12.1/src/lib/misc.h Examining data/editorconfig-core-0.12.1/src/lib/utarray.h FINAL RESULTS: data/editorconfig-core-0.12.1/src/lib/ec_glob.c:51: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(p, string); \ data/editorconfig-core-0.12.1/src/lib/ec_glob.c:82: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(l_pattern, pattern); data/editorconfig-core-0.12.1/src/lib/editorconfig.c:156:12: [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). strlwr(strcpy(name_lwr, name)); data/editorconfig-core-0.12.1/src/lib/editorconfig.c:240: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(pattern, hfparam->editorconfig_file_dir); data/editorconfig-core-0.12.1/src/lib/editorconfig.c:248: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(pattern, section); data/editorconfig-core-0.12.1/src/lib/editorconfig.c:324:9: [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(files[i], currdir); data/editorconfig-core-0.12.1/src/lib/editorconfig.c:326:9: [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(files[i], filename); data/editorconfig-core-0.12.1/src/bin/main.c:77: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 file_line_buffer[FILENAME_MAX + 1]; data/editorconfig-core-0.12.1/src/bin/main.c:102: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). ver = atoi(pos); data/editorconfig-core-0.12.1/src/lib/ec_glob.c:65: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 pcre_str[2 * PATTERN_MAX] = "^"; data/editorconfig-core-0.12.1/src/lib/ec_glob.c:76: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 l_pattern[2 * PATTERN_MAX]; data/editorconfig-core-0.12.1/src/lib/ec_glob.c:174:21: [2] (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 string. strcat(p_pcre, "\\]"); data/editorconfig-core-0.12.1/src/lib/ec_glob.c:256:33: [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). pair.num1 = atoi(c + 1); data/editorconfig-core-0.12.1/src/lib/ec_glob.c:257:33: [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). pair.num2 = atoi(double_dots + 2); data/editorconfig-core-0.12.1/src/lib/ec_glob.c:353:15: [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). num = atoi(num_string); data/editorconfig-core-0.12.1/src/lib/editorconfig.c:141: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 name_lwr[MAX_PROPERTY_NAME]; data/editorconfig-core-0.12.1/src/lib/editorconfig.c:243:9: [2] (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 string. strcat(pattern, "**/"); data/editorconfig-core-0.12.1/src/lib/ini.c:106: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 line[MAX_LINE]; data/editorconfig-core-0.12.1/src/lib/ini.c:107: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 section[MAX_SECTION] = ""; data/editorconfig-core-0.12.1/src/lib/ini.c:108: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 prev_name[MAX_NAME] = ""; data/editorconfig-core-0.12.1/src/lib/ini.c:194:12: [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 = fopen(filename, "r"); data/editorconfig-core-0.12.1/src/lib/misc.c:130: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(copy, str, len); data/editorconfig-core-0.12.1/src/lib/misc.c:188: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(copy, str, len); data/editorconfig-core-0.12.1/src/lib/utarray.h:102:10: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. else { memcpy(_utarray_eltptr(a,(a)->i++), p, (a)->icd.sz); }; \ data/editorconfig-core-0.12.1/src/lib/utarray.h:130:10: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. else { memcpy(_utarray_eltptr(a,j), p, (a)->icd.sz); }; \ data/editorconfig-core-0.12.1/src/lib/utarray.h:149: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(_utarray_eltptr(a,j), _utarray_eltptr(w,0), \ data/editorconfig-core-0.12.1/src/bin/main.c:191: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). len = strlen(file_line_buffer) - 1; data/editorconfig-core-0.12.1/src/lib/ec_glob.c:48: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). size_t string_len = strlen(string); \ data/editorconfig-core-0.12.1/src/lib/ec_glob.c:77:48: [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 pattern_length = strlen(pattern); data/editorconfig-core-0.12.1/src/lib/ec_glob.c:172:21: [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(p_pcre, "\\"); data/editorconfig-core-0.12.1/src/lib/ec_glob.c:173:21: [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. strncat(p_pcre, c, right_bracket - c); data/editorconfig-core-0.12.1/src/lib/ec_glob.c:175:31: [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). p_pcre += strlen(p_pcre); data/editorconfig-core-0.12.1/src/lib/ec_glob.c:248:43: [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). memmove(cc+1, cc, strlen(cc) + 1); data/editorconfig-core-0.12.1/src/lib/ec_glob.c:321:44: [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). rc = pcre_exec(re, NULL, string, (int) strlen(string), 0, 0, data/editorconfig-core-0.12.1/src/lib/editorconfig.c:236: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). strlen(hfparam->editorconfig_file_dir) * sizeof(char) + data/editorconfig-core-0.12.1/src/lib/editorconfig.c:237: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). sizeof("**/") + strlen(section) * sizeof(char)); data/editorconfig-core-0.12.1/src/lib/editorconfig.c:246:9: [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(pattern, "/"); data/editorconfig-core-0.12.1/src/lib/editorconfig.c:286:42: [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). *filename = strndup(path_char+1, strlen(path_char)-1); data/editorconfig-core-0.12.1/src/lib/editorconfig.c:323:27: [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). files[i] = malloc(strlen(currdir) + strlen(filename) + 2); data/editorconfig-core-0.12.1/src/lib/editorconfig.c:323:45: [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). files[i] = malloc(strlen(currdir) + strlen(filename) + 2); data/editorconfig-core-0.12.1/src/lib/editorconfig.c:325:9: [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(files[i], "/"); data/editorconfig-core-0.12.1/src/lib/ini.c:50: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). char* p = s + strlen(s); data/editorconfig-core-0.12.1/src/lib/ini.c:93:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(dest, src, size); data/editorconfig-core-0.12.1/src/lib/misc.c:127: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). len = strlen(str) + 1; ANALYSIS SUMMARY: Hits = 44 Lines analyzed = 2911 in approximately 0.11 seconds (26323 lines/second) Physical Source Lines of Code (SLOC) = 1474 Hits@level = [0] 16 [1] 18 [2] 19 [3] 0 [4] 7 [5] 0 Hits@level+ = [0+] 60 [1+] 44 [2+] 26 [3+] 7 [4+] 7 [5+] 0 Hits/KSLOC@level+ = [0+] 40.7056 [1+] 29.8507 [2+] 17.6391 [3+] 4.74898 [4+] 4.74898 [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.