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-fullwidthchar-enhance-0.0~git20150311/src/cfgrw.c Examining data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/cfgrw.h Examining data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/fullwidthchar-enhance.c Examining data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/dictionary.c Examining data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/dictionary.h Examining data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/iniexample.c Examining data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/iniparser.c Examining data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/iniparser.h Examining data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/parse.c FINAL RESULTS: data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/cfgrw.c:34: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(val, s); data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/fullwidthchar-enhance.c:168: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(FcitxInstanceGetInputState(fwchar->owner)), sCornerTrans[sym - 32]); data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/fullwidthchar-enhance.c:203:17: [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(ret, sCornerTrans[sym - 32]); data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/dictionary.c:68: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(t,s); data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/iniparser.c:83: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(l, s); data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/iniparser.c:255:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(keym, "%s:", s); data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/iniparser.c:290:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(keym, "%s:", s); data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/iniparser.c:336:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(keym, "%s:", s); data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/iniparser.c:565: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(line, strstrip(input_line)); data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/iniparser.c:578: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(section, strstrip(section)); data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/iniparser.c:579: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(section, strlwc(section)); data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/iniparser.c:585: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(key, strstrip(key)); data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/iniparser.c:586: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(key, strlwc(key)); data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/iniparser.c:587: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(value, strstrip(value)); data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/iniparser.c:604: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(key, strstrip(key)); data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/iniparser.c:605: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(key, strlwc(key)); data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/iniparser.c:702:13: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tmp, "%s:%s", section, key); data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/cfgrw.c:13:19: [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 *homePath = getenv("HOME"); data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/cfgrw.c:12: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 usrPath[BUFF_SIZE] = {0}; data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/cfgrw.c:23: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 val[VALUE_SIZE] = {0}; data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/dictionary.c:46: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(newptr, ptr, size); data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/dictionary.c:365: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 cval[90] ; data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/dictionary.c:374:9: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(cval, "%04d", i); data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/dictionary.c:379:9: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(cval, "%04d", i); data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/dictionary.c:387:9: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(cval, "%04d", i); data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/iniexample.c:28:11: [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). ini = fopen("example.ini", "w"); data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/iniparser.c:46:12: [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 l[ASCIILINESZ+1]; data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/iniparser.c:76:12: [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 l[ASCIILINESZ+1]; data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/iniparser.c:247: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 keym[ASCIILINESZ+1]; data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/iniparser.c:281: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 keym[ASCIILINESZ+1]; data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/iniparser.c:323: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 keym[ASCIILINESZ+1]; data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/iniparser.c:562: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 line[ASCIILINESZ+1]; data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/iniparser.c:633: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 line [ASCIILINESZ+1] ; data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/iniparser.c:634: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 section [ASCIILINESZ+1] ; data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/iniparser.c:635: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 key [ASCIILINESZ+1] ; data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/iniparser.c:636: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 tmp [ASCIILINESZ+1] ; data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/iniparser.c:637: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 val [ASCIILINESZ+1] ; data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/iniparser.c:646: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 ((in=fopen(ininame, "r"))==NULL) { data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/fullwidthchar-enhance.c:204:28: [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). ret_len += strlen(sCornerTrans[sym - 32]); data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/fullwidthchar-enhance.c:206:17: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(ret, ps, chr_len); data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/dictionary.c:66:23: [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). t = (char*)malloc(strlen(s)+1) ; data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/dictionary.c:94:11: [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). len = strlen(key); data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/iniparser.c:84:16: [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). last = l + strlen(l); data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/iniparser.c:253:20: [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). seclen = (int)strlen(s); data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/iniparser.c:289:20: [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). seclen = (int)strlen(s); data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/iniparser.c:335:20: [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). seclen = (int)strlen(s); data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/iniparser.c:566:16: [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). len = (int)strlen(line); data/fcitx-fullwidthchar-enhance-0.0~git20150311/src/iniparser/iniparser.c:665:20: [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). len = (int)strlen(line)-1; ANALYSIS SUMMARY: Hits = 48 Lines analyzed = 2064 in approximately 0.10 seconds (19903 lines/second) Physical Source Lines of Code (SLOC) = 898 Hits@level = [0] 40 [1] 10 [2] 20 [3] 1 [4] 17 [5] 0 Hits@level+ = [0+] 88 [1+] 48 [2+] 38 [3+] 18 [4+] 17 [5+] 0 Hits/KSLOC@level+ = [0+] 97.9955 [1+] 53.4521 [2+] 42.3163 [3+] 20.0445 [4+] 18.931 [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.