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/acpi-1.7/acpi.c Examining data/acpi-1.7/list.h Examining data/acpi-1.7/acpi.h Examining data/acpi-1.7/main.c Examining data/acpi-1.7/list.c FINAL RESULTS: data/acpi-1.7/acpi.c:174:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(filename, "%s/%s", device_name, list[i].file); data/acpi-1.7/main.c:71:2: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(ACPI_VERSION_STRING "\n" data/acpi-1.7/main.c:149:15: [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 ((ch = getopt_long(argc, argv, "ipVbtashvfkcd:", long_options, &option_index)) != -1) { data/acpi-1.7/acpi.c:102: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[BUF_SIZE]; data/acpi-1.7/acpi.c:104: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). fd = fopen(filename, "r"); data/acpi-1.7/acpi.c:270:2: [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 capacity_unit[4] = "mAh"; data/acpi-1.7/acpi.c:332:4: [2] (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). Risk is low because the source is a constant string. strcpy(capacity_unit, "mWh"); data/acpi-1.7/acpi.c:340:4: [2] (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). Risk is low because the source is a constant string. strcpy(capacity_unit, "mWh"); data/acpi-1.7/acpi.c:518:4: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(str, "trip_point_%d_temp", i); data/acpi-1.7/acpi.c:522:4: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(str, "trip_point_%d_type", i); data/acpi-1.7/acpi.c:69:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(attr, buf, p - buf); data/acpi-1.7/acpi.c:87:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(attr, given_attr, BUF_SIZE); data/acpi-1.7/acpi.c:89:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(value, p, BUF_SIZE); data/acpi-1.7/acpi.c:90:14: [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 (attr[strlen(attr) - 1] == '\n') data/acpi-1.7/acpi.c:91:7: [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). attr[strlen(attr) - 1] = '\0'; data/acpi-1.7/acpi.c:92: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). if (value[strlen(value) - 1] == '\n') data/acpi-1.7/acpi.c:93:8: [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). value[strlen(value) - 1] = '\0'; data/acpi-1.7/acpi.c:166: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). char *filename = malloc(strlen(device_name) + strlen("/energy_full_design ")); data/acpi-1.7/acpi.c:166:51: [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 *filename = malloc(strlen(device_name) + strlen("/energy_full_design ")); ANALYSIS SUMMARY: Hits = 19 Lines analyzed = 1042 in approximately 0.04 seconds (24643 lines/second) Physical Source Lines of Code (SLOC) = 810 Hits@level = [0] 25 [1] 9 [2] 7 [3] 1 [4] 2 [5] 0 Hits@level+ = [0+] 44 [1+] 19 [2+] 10 [3+] 3 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 54.321 [1+] 23.4568 [2+] 12.3457 [3+] 3.7037 [4+] 2.46914 [5+] 0 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.