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-googlepinyin-0.1.6/src/eim.cpp Examining data/fcitx-googlepinyin-0.1.6/src/eim.h Examining data/fcitx-googlepinyin-0.1.6/standalone/main.cpp FINAL RESULTS: data/fcitx-googlepinyin-0.1.6/src/eim.cpp:333: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(FcitxInputStateGetRawInputBuffer(input), googlepinyin->buf); data/fcitx-googlepinyin-0.1.6/src/eim.cpp:388: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(FcitxInputStateGetOutputString(input), googlepinyin->ubuf); data/fcitx-googlepinyin-0.1.6/src/eim.cpp:389:9: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(FcitxInputStateGetOutputString(input), googlepinyin->buf + len); data/fcitx-googlepinyin-0.1.6/src/eim.cpp:421: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(FcitxInputStateGetOutputString(input), googlepinyin->ubuf); data/fcitx-googlepinyin-0.1.6/src/eim.cpp:422:9: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(FcitxInputStateGetOutputString(input), googlepinyin->buf + len); data/fcitx-googlepinyin-0.1.6/src/eim.cpp:468: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-googlepinyin-0.1.6/src/eim.cpp:296: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 pybuf[ime_pinyin::kMaxPinyinSize + 2]; /* py */ data/fcitx-googlepinyin-0.1.6/src/eim.cpp:447: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 b[2]; data/fcitx-googlepinyin-0.1.6/src/eim.h:48: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[MAX_GOOGLEPINYIN_INPUT + 1]; data/fcitx-googlepinyin-0.1.6/src/eim.h:49: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[UTF8_BUF_LEN + 1]; data/fcitx-googlepinyin-0.1.6/standalone/main.cpp:23: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[4096]; data/fcitx-googlepinyin-0.1.6/src/eim.cpp:91:21: [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 buflen = strlen(googlepinyin->buf); data/fcitx-googlepinyin-0.1.6/src/eim.cpp:133: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). if (strlen(googlepinyin->buf) < MAX_GOOGLEPINYIN_INPUT) data/fcitx-googlepinyin-0.1.6/src/eim.cpp:135: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 len = strlen(googlepinyin->buf); data/fcitx-googlepinyin-0.1.6/src/eim.cpp:152: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). if (len == 0 && strlen(googlepinyin->buf) == 1) data/fcitx-googlepinyin-0.1.6/src/eim.cpp:164:26: [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(googlepinyin->buf); data/fcitx-googlepinyin-0.1.6/src/eim.cpp:174:13: [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). if (strlen(googlepinyin->buf) > 0) data/fcitx-googlepinyin-0.1.6/src/eim.cpp:189: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 len = strlen(googlepinyin->buf); data/fcitx-googlepinyin-0.1.6/src/eim.cpp:193:35: [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). googlepinyin->buf[strlen(googlepinyin->buf) - 1] = 0; data/fcitx-googlepinyin-0.1.6/src/eim.cpp:204:13: [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). if (strlen(googlepinyin->buf) > 0) data/fcitx-googlepinyin-0.1.6/src/eim.cpp:229: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 len = strlen(googlepinyin->buf); data/fcitx-googlepinyin-0.1.6/src/eim.cpp:251: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 len = strlen(googlepinyin->buf); data/fcitx-googlepinyin-0.1.6/src/eim.cpp:291:26: [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 iCursorPos = strlen(googlepinyin->ubuf); data/fcitx-googlepinyin-0.1.6/src/eim.cpp:298:13: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(pybuf, pystr + start[i], start[i + 1] - start[i]); data/fcitx-googlepinyin-0.1.6/src/eim.cpp:317:13: [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). if (strlen(googlepinyin->buf) > len) data/fcitx-googlepinyin-0.1.6/src/eim.cpp:325:39: [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). if (remainPos > (int) strlen(googlepinyin->buf + start[start_pos_len])) data/fcitx-googlepinyin-0.1.6/src/eim.cpp:326: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). remainPos = strlen(googlepinyin->buf + start[start_pos_len]); data/fcitx-googlepinyin-0.1.6/src/eim.cpp:334: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(googlepinyin->buf)); data/fcitx-googlepinyin-0.1.6/src/eim.cpp:390:13: [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). if (strlen(FcitxInputStateGetOutputString(input)) == 0) data/fcitx-googlepinyin-0.1.6/src/eim.cpp:423:13: [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). if (strlen(FcitxInputStateGetOutputString(input)) == 0) ANALYSIS SUMMARY: Hits = 30 Lines analyzed = 659 in approximately 0.03 seconds (19702 lines/second) Physical Source Lines of Code (SLOC) = 520 Hits@level = [0] 0 [1] 19 [2] 5 [3] 1 [4] 5 [5] 0 Hits@level+ = [0+] 30 [1+] 30 [2+] 11 [3+] 6 [4+] 5 [5+] 0 Hits/KSLOC@level+ = [0+] 57.6923 [1+] 57.6923 [2+] 21.1538 [3+] 11.5385 [4+] 9.61538 [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.