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/libkmfl-11.0.101/include/libkmfl.h Examining data/libkmfl-11.0.101/src/kmfl_interpreter.c Examining data/libkmfl-11.0.101/src/kmfl_load_keyboard.c Examining data/libkmfl-11.0.101/src/kmfl_messages.c FINAL RESULTS: data/libkmfl-11.0.101/src/kmfl_messages.c:33:3: [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(debugfile,fmt,args); data/libkmfl-11.0.101/src/kmfl_messages.c:44:2: [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, fmt, args); data/libkmfl-11.0.101/src/kmfl_interpreter.c:540:2: [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(p_kmsi->history+1, items, nitems * sizeof(ITEM)); data/libkmfl-11.0.101/src/kmfl_load_keyboard.c:36: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 * keyboard_filename[MAX_KEYBOARDS]; data/libkmfl-11.0.101/src/kmfl_load_keyboard.c:176: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 version_string[6]={0}; data/libkmfl-11.0.101/src/kmfl_load_keyboard.c:194:7: [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(version_string,p_kbd->version,4); // Copy to ensure terminated data/libkmfl-11.0.101/src/kmfl_load_keyboard.c:195:25: [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). kbver = (unsigned)atoi(version_string); data/libkmfl-11.0.101/src/kmfl_load_keyboard.c:214:13: [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). if((fp=fopen(filename,"rb")) != NULL) data/libkmfl-11.0.101/src/kmfl_load_keyboard.c:222:7: [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(version_string,p_kbd->version,4); // Copy to ensure terminated data/libkmfl-11.0.101/src/kmfl_load_keyboard.c:223:25: [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). kbver = (unsigned)atoi(version_string); data/libkmfl-11.0.101/src/kmfl_load_keyboard.c:229:25: [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). || (kbver < (unsigned)atoi(BASE_VERSION)) data/libkmfl-11.0.101/src/kmfl_load_keyboard.c:230:25: [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). || (kbver > (unsigned)atoi(LAST_VERSION))) data/libkmfl-11.0.101/src/kmfl_load_keyboard.c:287: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 version_string[6]={0}; data/libkmfl-11.0.101/src/kmfl_load_keyboard.c:291:9: [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). if((fp=fopen(file,"rb")) == NULL) data/libkmfl-11.0.101/src/kmfl_load_keyboard.c:302:2: [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(version_string,xkb.version,3); // Copy to ensure terminated data/libkmfl-11.0.101/src/kmfl_load_keyboard.c:303:20: [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). kbver = (unsigned)atoi(version_string); data/libkmfl-11.0.101/src/kmfl_load_keyboard.c:310: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). if(kbver < (unsigned)atoi(BASE_VERSION)) data/libkmfl-11.0.101/src/kmfl_load_keyboard.c:312: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). if(kbver > (unsigned)atoi(LAST_VERSION)) data/libkmfl-11.0.101/src/kmfl_load_keyboard.c:444:9: [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 icon_name[256]; data/libkmfl-11.0.101/src/kmfl_messages.c:30:13: [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). debugfile=fopen("/tmp/libkmfldebug.log", "a"); data/libkmfl-11.0.101/src/kmfl_load_keyboard.c:147:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(p_kmsi->kbd_name,p_kbd->name, NAMELEN); ANALYSIS SUMMARY: Hits = 21 Lines analyzed = 1339 in approximately 0.07 seconds (20096 lines/second) Physical Source Lines of Code (SLOC) = 923 Hits@level = [0] 4 [1] 1 [2] 18 [3] 0 [4] 2 [5] 0 Hits@level+ = [0+] 25 [1+] 21 [2+] 20 [3+] 2 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 27.0856 [1+] 22.7519 [2+] 21.6685 [3+] 2.16685 [4+] 2.16685 [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.