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-sunpinyin-0.4.2/src/config.cpp Examining data/fcitx-sunpinyin-0.4.2/src/eim.cpp Examining data/fcitx-sunpinyin-0.4.2/src/eim.h Examining data/fcitx-sunpinyin-0.4.2/src/handler.cpp Examining data/fcitx-sunpinyin-0.4.2/src/handler.h Examining data/fcitx-sunpinyin-0.4.2/test/shuangpin_decode.cpp FINAL RESULTS: data/fcitx-sunpinyin-0.4.2/src/eim.cpp:394: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("FCITXDIR")) { data/fcitx-sunpinyin-0.4.2/src/eim.cpp:295: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(sunpinyin->front_src, src, ppd.caret() * sizeof(TWCHAR)); data/fcitx-sunpinyin-0.4.2/src/eim.cpp:296: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(sunpinyin->end_src, src + ppd.caret() * sizeof(TWCHAR), data/fcitx-sunpinyin-0.4.2/src/eim.cpp:298: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(sunpinyin->input_src, src, hzlen * sizeof(TWCHAR)); data/fcitx-sunpinyin-0.4.2/src/eim.cpp:642: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 s[2] = {symbol[i], '\0'}; data/fcitx-sunpinyin-0.4.2/src/eim.h:91: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 ubuf[BUF_SIZE]; data/fcitx-sunpinyin-0.4.2/src/eim.h:95: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 preedit[BUF_SIZE]; data/fcitx-sunpinyin-0.4.2/src/eim.h:96: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 clientpreedit[BUF_SIZE]; data/fcitx-sunpinyin-0.4.2/src/eim.cpp:311:40: [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). FcitxInputStateSetCursorPos(input, strlen(sunpinyin->preedit)); data/fcitx-sunpinyin-0.4.2/src/eim.cpp:312:34: [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). WCSTOMBS(&sunpinyin->preedit[strlen(sunpinyin->preedit)], sunpinyin->end_src, MAX_USER_INPUT); data/fcitx-sunpinyin-0.4.2/src/handler.cpp:42:49: [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). FcitxInputStateSetRawInputBufferSize(input, strlen(FcitxInputStateGetRawInputBuffer(input))); ANALYSIS SUMMARY: Hits = 11 Lines analyzed = 998 in approximately 0.06 seconds (16163 lines/second) Physical Source Lines of Code (SLOC) = 694 Hits@level = [0] 0 [1] 3 [2] 7 [3] 1 [4] 0 [5] 0 Hits@level+ = [0+] 11 [1+] 11 [2+] 8 [3+] 1 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 15.8501 [1+] 15.8501 [2+] 11.5274 [3+] 1.44092 [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.