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/onboard-1.4.1/Onboard/pypredict/lm/accent_transform.h Examining data/onboard-1.4.1/Onboard/pypredict/lm/lm_dynamic_impl.h Examining data/onboard-1.4.1/Onboard/pypredict/lm/lm_unigram.cpp Examining data/onboard-1.4.1/Onboard/pypredict/lm/lm_dynamic_kn.h Examining data/onboard-1.4.1/Onboard/pypredict/lm/lm_python.cpp Examining data/onboard-1.4.1/Onboard/pypredict/lm/lm_dynamic_cached.h Examining data/onboard-1.4.1/Onboard/pypredict/lm/lm_merged.cpp Examining data/onboard-1.4.1/Onboard/pypredict/lm/pool_allocator.cpp Examining data/onboard-1.4.1/Onboard/pypredict/lm/lm.h Examining data/onboard-1.4.1/Onboard/pypredict/lm/lm_unigram.h Examining data/onboard-1.4.1/Onboard/pypredict/lm/lm.cpp Examining data/onboard-1.4.1/Onboard/pypredict/lm/lm_dynamic.h Examining data/onboard-1.4.1/Onboard/pypredict/lm/lm_merged.h Examining data/onboard-1.4.1/Onboard/pypredict/lm/lm_dynamic.cpp Examining data/onboard-1.4.1/Onboard/osk/osk_virtkey.h Examining data/onboard-1.4.1/Onboard/osk/osk_audio.c Examining data/onboard-1.4.1/Onboard/osk/osk_hunspell.c Examining data/onboard-1.4.1/Onboard/osk/osk_uinput.h Examining data/onboard-1.4.1/Onboard/osk/osk_virtkey_wayland.h Examining data/onboard-1.4.1/Onboard/osk/osk_devices.c Examining data/onboard-1.4.1/Onboard/osk/osk_dconf.c Examining data/onboard-1.4.1/Onboard/osk/osk_uinput.c Examining data/onboard-1.4.1/Onboard/osk/osk_struts.c Examining data/onboard-1.4.1/Onboard/osk/osk_util.c Examining data/onboard-1.4.1/Onboard/osk/osk_virtkey_x.h Examining data/onboard-1.4.1/Onboard/osk/osk_click_mapper.c Examining data/onboard-1.4.1/Onboard/osk/osk_virtkey_x.c Examining data/onboard-1.4.1/Onboard/osk/osk_module.c Examining data/onboard-1.4.1/Onboard/osk/osk_udev.c Examining data/onboard-1.4.1/Onboard/osk/osk_virtkey.c Examining data/onboard-1.4.1/Onboard/osk/osk_module.h Examining data/onboard-1.4.1/Onboard/osk/osk_virtkey_wayland.c FINAL RESULTS: data/onboard-1.4.1/Onboard/pypredict/lm/lm.cpp:284: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(w, wtmp); data/onboard-1.4.1/Onboard/pypredict/lm/lm.cpp:360: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(w, wtmp); data/onboard-1.4.1/Onboard/pypredict/lm/lm.cpp:724:9: [4] (buffer) wcscpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using a function version that stops copying at the end of the buffer. wcscpy (text + size, buf); data/onboard-1.4.1/Onboard/osk/osk_virtkey_x.c:556:9: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if (getenv ("VIRTKEY_DEBUG")) data/onboard-1.4.1/Onboard/osk/osk_click_mapper.c:66:14: [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. unsigned char buttons[MAX_BUTTONS]; data/onboard-1.4.1/Onboard/osk/osk_click_mapper.c:155:14: [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. unsigned char buttons[MAX_BUTTONS]; data/onboard-1.4.1/Onboard/osk/osk_click_mapper.c:181:9: [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(saved_state->buttons, buttons, sizeof(buttons)); data/onboard-1.4.1/Onboard/osk/osk_devices.c:288:18: [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. unsigned char mask[2] = { 0, 0 }; data/onboard-1.4.1/Onboard/osk/osk_devices.c:315:18: [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. unsigned char mask[2] = { 0, 0 }; data/onboard-1.4.1/Onboard/osk/osk_devices.c:1191:14: [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. unsigned char mask[1] = {0}; data/onboard-1.4.1/Onboard/osk/osk_devices.c:1266:14: [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. unsigned char mask[4] = { 0, 0, 0, 0}; data/onboard-1.4.1/Onboard/osk/osk_devices.c:1309:14: [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. unsigned char mask[1] = { 0 }; data/onboard-1.4.1/Onboard/osk/osk_uinput.c:73:10: [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("/dev/uinput", O_WRONLY | O_NONBLOCK); data/onboard-1.4.1/Onboard/osk/osk_virtkey.c:1077:20: [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 buf[256]; data/onboard-1.4.1/Onboard/osk/osk_virtkey.c:1329: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 label[max_label_size+1]; data/onboard-1.4.1/Onboard/pypredict/lm/lm.cpp:703:15: [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* f = fopen(filename, "r,ccs=UTF-8"); data/onboard-1.4.1/Onboard/pypredict/lm/lm.h:113:20: [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 outstr[4096]; data/onboard-1.4.1/Onboard/pypredict/lm/lm.h:146:20: [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 outstr[4096]; data/onboard-1.4.1/Onboard/pypredict/lm/lm_dynamic.cpp:49:15: [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* f = fopen(filename, "r,ccs=UTF-8"); data/onboard-1.4.1/Onboard/pypredict/lm/lm_dynamic.cpp:61:9: [2] (buffer) wchar_t: 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. wchar_t buf[4096]; data/onboard-1.4.1/Onboard/pypredict/lm/lm_dynamic.cpp:244:15: [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* f = fopen(filename, "w,ccs=UTF-8"); data/onboard-1.4.1/Onboard/pypredict/lm/lm_dynamic_impl.h:71:21: [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(pnew, p, old_bytes); data/onboard-1.4.1/Onboard/osk/osk_hunspell.c:114:58: [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). PyObject* suggestion = PyUnicode_Decode(slst[i], strlen(slst[i]), data/onboard-1.4.1/Onboard/osk/osk_virtkey.c:1094:36: [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 l = MIN(strlen(name), sizeof(buf)-1); data/onboard-1.4.1/Onboard/osk/osk_virtkey.c:1095:21: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buf, name, l); data/onboard-1.4.1/Onboard/osk/osk_virtkey_wayland.c:228:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(label, virtkey_get_label_from_keysym(keysym), max_label_size); data/onboard-1.4.1/Onboard/osk/osk_virtkey_x.c:399:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(label, virtkey_get_label_from_keysym(keysym), max_label_size); data/onboard-1.4.1/Onboard/pypredict/lm/lm.cpp:281:36: [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* w = (char*)MemAlloc((strlen(wtmp) + 1) * sizeof(char)); data/onboard-1.4.1/Onboard/pypredict/lm/lm.cpp:357:32: [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* w = (char*)MemAlloc((strlen(wtmp) + 1) * sizeof(char)); data/onboard-1.4.1/Onboard/pypredict/lm/lm.cpp:446: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). int len = strlen(w); data/onboard-1.4.1/Onboard/pypredict/lm/lm.cpp:483: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). w += (strlen(words[i]) + 1); data/onboard-1.4.1/Onboard/pypredict/lm/lm.cpp:514:34: [1] (buffer) wcslen: 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). bool has_prefix = (prefix && wcslen(prefix)); data/onboard-1.4.1/Onboard/pypredict/lm/lm.cpp:722:17: [1] (buffer) wcslen: 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 l = wcslen(buf); data/onboard-1.4.1/Onboard/pypredict/lm/lm.h:111:30: [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 inbytes = strlen(instr); data/onboard-1.4.1/Onboard/pypredict/lm/lm.h:144:30: [1] (buffer) wcslen: 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 inbytes = wcslen(instr) * sizeof(*instr); data/onboard-1.4.1/Onboard/pypredict/lm/lm_python.cpp:804:54: [1] (buffer) wcslen: 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). oword = PyUnicode_FromWideChar(word, wcslen(word)); data/onboard-1.4.1/Onboard/pypredict/lm/lm_python.cpp:1282:42: [1] (buffer) wcslen: 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). return PyUnicode_FromWideChar(s, wcslen(s)); data/onboard-1.4.1/Onboard/pypredict/lm/lm_python.cpp:1559:42: [1] (buffer) wcslen: 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). return PyUnicode_FromWideChar(s, wcslen(s)); ANALYSIS SUMMARY: Hits = 38 Lines analyzed = 15273 in approximately 0.37 seconds (41056 lines/second) Physical Source Lines of Code (SLOC) = 11700 Hits@level = [0] 51 [1] 16 [2] 18 [3] 1 [4] 3 [5] 0 Hits@level+ = [0+] 89 [1+] 38 [2+] 22 [3+] 4 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 7.60684 [1+] 3.24786 [2+] 1.88034 [3+] 0.34188 [4+] 0.25641 [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.