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/libinih-50/cpp/INIReader.cpp Examining data/libinih-50/cpp/INIReader.h Examining data/libinih-50/examples/INIReaderExample.cpp Examining data/libinih-50/examples/ini_dump.c Examining data/libinih-50/examples/ini_example.c Examining data/libinih-50/examples/ini_xmacros.c Examining data/libinih-50/tests/parseargs.c Examining data/libinih-50/tests/parseargs.h Examining data/libinih-50/tests/unittest.c Examining data/libinih-50/tests/unittest_string.c Examining data/libinih-50/ini.c Examining data/libinih-50/ini.h FINAL RESULTS: data/libinih-50/tests/parseargs.c:51:17: [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. int c = getopt_long(argc, argv, "", long_options, &option_index); data/libinih-50/examples/ini_dump.c:10:12: [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 prev_section[50] = ""; data/libinih-50/examples/ini_example.c:22: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). pconfig->version = atoi(value); data/libinih-50/ini.c:89: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(dest, src, size - 1); data/libinih-50/ini.c:99: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_buf[ini_use_stack ? ini_max_line : 0]; data/libinih-50/ini.c:110: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/libinih-50/ini.c:111: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/libinih-50/ini.c:245: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/libinih-50/tests/parseargs.c:59:28: [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 **) optargs[option_index].val) = strdup(optarg); data/libinih-50/tests/parseargs.c:62:64: [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). *((int *) optargs[option_index].val) = atoi(optarg); data/libinih-50/tests/parseargs.c:65:65: [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). *((bool *) optargs[option_index].val) = atoi(optarg); data/libinih-50/tests/unittest.c:24:1: [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_section[50]; data/libinih-50/tests/unittest_string.c:10:1: [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_section[50]; data/libinih-50/examples/ini_dump.c:14:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(prev_section, section, sizeof(prev_section)); data/libinih-50/ini.c:51: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/libinih-50/ini.c:136: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). offset = strlen(line); data/libinih-50/ini.c:151:23: [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). offset += strlen(line + offset); data/libinih-50/ini.c:285: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). ctx.num_left = strlen(string); data/libinih-50/tests/unittest.c:32:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(Prev_section, section, sizeof(Prev_section)); data/libinih-50/tests/unittest_string.c:18:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(Prev_section, section, sizeof(Prev_section)); ANALYSIS SUMMARY: Hits = 20 Lines analyzed = 1008 in approximately 0.07 seconds (13998 lines/second) Physical Source Lines of Code (SLOC) = 706 Hits@level = [0] 17 [1] 7 [2] 12 [3] 1 [4] 0 [5] 0 Hits@level+ = [0+] 37 [1+] 20 [2+] 13 [3+] 1 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 52.4079 [1+] 28.3286 [2+] 18.4136 [3+] 1.41643 [4+] 0 [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.