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/gkrellm-thinkbat-0.2.2/collect_data.c Examining data/gkrellm-thinkbat-0.2.2/collect_data.h Examining data/gkrellm-thinkbat-0.2.2/gkrellm-thinkbat.c Examining data/gkrellm-thinkbat-0.2.2/gkrellm-thinkbat.h FINAL RESULTS: data/gkrellm-thinkbat-0.2.2/collect_data.c:44:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(file, "%s%s%s", SMAPI_PATH, BATTERY, DESIGN_CAPACITY); data/gkrellm-thinkbat-0.2.2/collect_data.c:47:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(file, "%s%s%s", SMAPI_PATH, BATTERY, REMAINING_CAPACITY); data/gkrellm-thinkbat-0.2.2/collect_data.c:50:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(file, "%s%s%s", SMAPI_PATH, BATTERY, POWER_NOW); data/gkrellm-thinkbat-0.2.2/collect_data.c:53:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(file, "%s%s%s", SMAPI_PATH, BATTERY, POWER_AVG); data/gkrellm-thinkbat-0.2.2/collect_data.c:56:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(file, "%s%s%s", SMAPI_PATH, BATTERY, LAST_FULL); data/gkrellm-thinkbat-0.2.2/collect_data.c:59:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(file, "%s%s", SMAPI_PATH, AC); data/gkrellm-thinkbat-0.2.2/collect_data.c:129:2: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. sscanf(buff, "%d %s", &data, dump); data/gkrellm-thinkbat-0.2.2/collect_data.c:42: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 file[FILE_LEN]; data/gkrellm-thinkbat-0.2.2/collect_data.c:116: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 buff[BUF_LEN], dump[10]; data/gkrellm-thinkbat-0.2.2/collect_data.c:118:7: [2] (misc) open: 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 = open(file, O_RDONLY); data/gkrellm-thinkbat-0.2.2/collect_data.c:123:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if(read(fd, buff, BUF_LEN) <= 0) { data/gkrellm-thinkbat-0.2.2/gkrellm-thinkbat.c:159:6: [1] (buffer) sscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. if (sscanf(arg, "%31s %[^\n]", config, item) == 2) { ANALYSIS SUMMARY: Hits = 12 Lines analyzed = 492 in approximately 0.03 seconds (18054 lines/second) Physical Source Lines of Code (SLOC) = 336 Hits@level = [0] 9 [1] 2 [2] 3 [3] 0 [4] 7 [5] 0 Hits@level+ = [0+] 21 [1+] 12 [2+] 10 [3+] 7 [4+] 7 [5+] 0 Hits/KSLOC@level+ = [0+] 62.5 [1+] 35.7143 [2+] 29.7619 [3+] 20.8333 [4+] 20.8333 [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.