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/fcitx-fbterm-0.2.0/src/fcitx-fbterm.c Examining data/fcitx-fbterm-0.2.0/src/imapi.c Examining data/fcitx-fbterm-0.2.0/src/imapi.h Examining data/fcitx-fbterm-0.2.0/src/immessage.h Examining data/fcitx-fbterm-0.2.0/src/input_key.h Examining data/fcitx-fbterm-0.2.0/src/keycode.c Examining data/fcitx-fbterm-0.2.0/src/keycode.h Examining data/fcitx-fbterm-0.2.0/src/keymap.c Examining data/fcitx-fbterm-0.2.0/src/keymap.h FINAL RESULTS: data/fcitx-fbterm-0.2.0/src/imapi.c:50:21: [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. char *val = getenv("FBTERM_IM_SOCKET"); data/fcitx-fbterm-0.2.0/src/fcitx-fbterm.c:105:8: [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 textup[BUFSIZE]; data/fcitx-fbterm-0.2.0/src/fcitx-fbterm.c:106:8: [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 textdown[BUFSIZE]; data/fcitx-fbterm-0.2.0/src/fcitx-fbterm.c:107:8: [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 imname[BUFSIZE]; data/fcitx-fbterm-0.2.0/src/imapi.c:33:8: [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 pending_msg_buf[10240]; data/fcitx-fbterm-0.2.0/src/imapi.c:78: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[OFFSET(Message, texts) + len]; data/fcitx-fbterm-0.2.0/src/imapi.c:82: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(MSG(buf)->texts, text, len); data/fcitx-fbterm-0.2.0/src/imapi.c:120: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[OFFSET(Message, drawText.texts) + len]; data/fcitx-fbterm-0.2.0/src/imapi.c:129: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(MSG(buf)->drawText.texts, text, len); data/fcitx-fbterm-0.2.0/src/imapi.c:241:17: [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(cur, cur + MSG(cur)->len, end - cur - MSG(cur)->len); data/fcitx-fbterm-0.2.0/src/imapi.c:263: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[sizeof(pending_msg_buf)]; data/fcitx-fbterm-0.2.0/src/imapi.c:270: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(buf, pending_msg_buf, len); data/fcitx-fbterm-0.2.0/src/immessage.h:168: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. char keys[0]; ///< included in message SendKey data/fcitx-fbterm-0.2.0/src/immessage.h:169: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. char texts[0]; ///< included in message PutText data/fcitx-fbterm-0.2.0/src/immessage.h:197:13: [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 texts[0]; data/fcitx-fbterm-0.2.0/src/keycode.c:31:8: [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 key_down[NR_KEYS]; data/fcitx-fbterm-0.2.0/src/keycode.c:32:17: [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 unsigned char shift_down[NR_SHIFT]; data/fcitx-fbterm-0.2.0/src/fcitx-fbterm.c:48:76: [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). draw_text(rect.x + MARGIN, rect.y + MARGIN, Black, Gray, (STRING), strlen(STRING)); \ data/fcitx-fbterm-0.2.0/src/fcitx-fbterm.c:172:22: [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 len = strlen(str); data/fcitx-fbterm-0.2.0/src/fcitx-fbterm.c:260:38: [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). put_im_text(str, strlen(str)); data/fcitx-fbterm-0.2.0/src/fcitx-fbterm.c:319:33: [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). unsigned short result_len = strlen(str); data/fcitx-fbterm-0.2.0/src/imapi.c:227:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int len = read(imfd, cur, sizeof(pending_msg_buf) - pending_msg_buf_len); data/fcitx-fbterm-0.2.0/src/imapi.c:274:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). len = read(imfd, buf, sizeof(buf)); data/fcitx-fbterm-0.2.0/src/keycode.c:217:17: [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). index = strlen(buf); ANALYSIS SUMMARY: Hits = 24 Lines analyzed = 1724 in approximately 0.07 seconds (23427 lines/second) Physical Source Lines of Code (SLOC) = 1156 Hits@level = [0] 4 [1] 7 [2] 16 [3] 1 [4] 0 [5] 0 Hits@level+ = [0+] 28 [1+] 24 [2+] 17 [3+] 1 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 24.2215 [1+] 20.7612 [2+] 14.7059 [3+] 0.865052 [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.