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-qimpanel-2.1.3/candidate_word.cpp Examining data/fcitx-qimpanel-2.1.3/candidate_word.h Examining data/fcitx-qimpanel-2.1.3/config-tool/candidate_word.cpp Examining data/fcitx-qimpanel-2.1.3/config-tool/candidate_word.h Examining data/fcitx-qimpanel-2.1.3/config-tool/editingskindialog.cpp Examining data/fcitx-qimpanel-2.1.3/config-tool/editingskindialog.h Examining data/fcitx-qimpanel-2.1.3/config-tool/kimpanelagenttype.h Examining data/fcitx-qimpanel-2.1.3/config-tool/main.cpp Examining data/fcitx-qimpanel-2.1.3/config-tool/main_model.cpp Examining data/fcitx-qimpanel-2.1.3/config-tool/main_model.h Examining data/fcitx-qimpanel-2.1.3/config-tool/mainwindow.cpp Examining data/fcitx-qimpanel-2.1.3/config-tool/mainwindow.h Examining data/fcitx-qimpanel-2.1.3/config-tool/skin/skinbase.cpp Examining data/fcitx-qimpanel-2.1.3/config-tool/skin/skinbase.h Examining data/fcitx-qimpanel-2.1.3/config-tool/skin/skinfcitx.cpp Examining data/fcitx-qimpanel-2.1.3/config-tool/skin/skinfcitx.h Examining data/fcitx-qimpanel-2.1.3/config-tool/skin/skinmenu.cpp Examining data/fcitx-qimpanel-2.1.3/config-tool/skin/skinmenu.h Examining data/fcitx-qimpanel-2.1.3/kimpanelagent.cpp Examining data/fcitx-qimpanel-2.1.3/kimpanelagent.h Examining data/fcitx-qimpanel-2.1.3/kimpanelagenttype.h Examining data/fcitx-qimpanel-2.1.3/main.cpp Examining data/fcitx-qimpanel-2.1.3/main.h Examining data/fcitx-qimpanel-2.1.3/main_controller.cpp Examining data/fcitx-qimpanel-2.1.3/main_controller.h Examining data/fcitx-qimpanel-2.1.3/main_model.cpp Examining data/fcitx-qimpanel-2.1.3/main_model.h Examining data/fcitx-qimpanel-2.1.3/my_action.cpp Examining data/fcitx-qimpanel-2.1.3/my_action.h Examining data/fcitx-qimpanel-2.1.3/skin/skinbase.cpp Examining data/fcitx-qimpanel-2.1.3/skin/skinbase.h Examining data/fcitx-qimpanel-2.1.3/skin/skinfcitx.cpp Examining data/fcitx-qimpanel-2.1.3/skin/skinfcitx.h Examining data/fcitx-qimpanel-2.1.3/system_tray_menu.cpp Examining data/fcitx-qimpanel-2.1.3/system_tray_menu.h Examining data/fcitx-qimpanel-2.1.3/toplevel.cpp Examining data/fcitx-qimpanel-2.1.3/toplevel.h FINAL RESULTS: data/fcitx-qimpanel-2.1.3/main.cpp:52:5: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod(filePath,0666); data/fcitx-qimpanel-2.1.3/main.cpp:58:5: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod(filePath, 0666); data/fcitx-qimpanel-2.1.3/config-tool/editingskindialog.cpp:193:16: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. if(0!= system(transpd)) data/fcitx-qimpanel-2.1.3/config-tool/editingskindialog.cpp:284:16: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. if(0!= system(transpd)) data/fcitx-qimpanel-2.1.3/config-tool/editingskindialog.cpp:307:16: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. if(0!= system(transpd)) data/fcitx-qimpanel-2.1.3/config-tool/editingskindialog.cpp:321:13: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. str.sprintf("rgb(%d,%d,%d)",color.red(), color.green(), color.blue()); data/fcitx-qimpanel-2.1.3/config-tool/editingskindialog.cpp:322:24: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. inputColorConf.sprintf("%d %d %d",color.red(),color.green(),color.blue()); data/fcitx-qimpanel-2.1.3/config-tool/editingskindialog.cpp:333:13: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. str.sprintf("rgb(%d,%d,%d)",color.red(), color.green(), color.blue()); data/fcitx-qimpanel-2.1.3/config-tool/editingskindialog.cpp:334:24: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. indexColorConf.sprintf("%d %d %d",color.red(),color.green(),color.blue()); data/fcitx-qimpanel-2.1.3/config-tool/editingskindialog.cpp:345:13: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. str.sprintf("rgb(%d,%d,%d)",color.red(), color.green(), color.blue()); data/fcitx-qimpanel-2.1.3/config-tool/editingskindialog.cpp:346:28: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. firstCandColorConf.sprintf("%d %d %d",color.red(),color.green(),color.blue()); data/fcitx-qimpanel-2.1.3/config-tool/editingskindialog.cpp:357:13: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. str.sprintf("rgb(%d,%d,%d)",color.red(), color.green(), color.blue()); data/fcitx-qimpanel-2.1.3/config-tool/editingskindialog.cpp:358:24: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. otherColorConf.sprintf("%d %d %d",color.red(),color.green(),color.blue()); data/fcitx-qimpanel-2.1.3/config-tool/editingskindialog.cpp:366:9: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. str.sprintf("rgb(%d,%d,%d)",color.red(), color.green(), color.blue()); data/fcitx-qimpanel-2.1.3/main.cpp:49:5: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf(filePath, BUFF_SIZE, LOCKFILE, fcitx_utils_get_display_number()); data/fcitx-qimpanel-2.1.3/main.cpp:79: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(filePath, PREFIX "/share/fcitx-qimpanel/"); data/fcitx-qimpanel-2.1.3/main.cpp:80: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(filePath + strlen(PREFIX "/share/fcitx-qimpanel/"), fileName); data/fcitx-qimpanel-2.1.3/main.cpp:88: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(filePath, PREFIX "/bin/"); data/fcitx-qimpanel-2.1.3/main.cpp:89: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(filePath + strlen(PREFIX "/bin/"), fileName); data/fcitx-qimpanel-2.1.3/system_tray_menu.cpp:331:13: [4] (shell) execvp: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. execvp("fcitx-qimpanel", argv_exec); data/fcitx-qimpanel-2.1.3/system_tray_menu.cpp:360:13: [4] (shell) execvp: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. execvp(app_exe, const_cast<char * const *>(argv)); data/fcitx-qimpanel-2.1.3/system_tray_menu.cpp:435:27: [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. const char *desktop = getenv("XDG_CURRENT_DESKTOP"); data/fcitx-qimpanel-2.1.3/config-tool/main.cpp:14:1: [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 sharePath[BUFF_SIZE] = {0}; data/fcitx-qimpanel-2.1.3/config-tool/skin/skinfcitx.cpp:49:28: [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). if (!fcitxSkinConfFile.open(QIODevice::ReadOnly)) data/fcitx-qimpanel-2.1.3/main.cpp:40:1: [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 filePath[BUFF_SIZE] = {0}; data/fcitx-qimpanel-2.1.3/main.cpp:46: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[16]; data/fcitx-qimpanel-2.1.3/main.cpp:51:14: [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). int fd = open(filePath, O_RDWR|O_CREAT, LOCKMODE); data/fcitx-qimpanel-2.1.3/main.cpp:71:5: [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(buf, "%d\n", getpid()); data/fcitx-qimpanel-2.1.3/main_controller.cpp:58:20: [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). if(!os_release.open(QIODevice::ReadOnly)) data/fcitx-qimpanel-2.1.3/skin/skinfcitx.cpp:51:28: [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). if (!fcitxSkinConfFile.open(QIODevice::ReadOnly)) data/fcitx-qimpanel-2.1.3/system_tray_menu.cpp:399:15: [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. const char *argv[4] = { "gkbd-keyboard-display", "-l", NULL, NULL }; data/fcitx-qimpanel-2.1.3/system_tray_menu.cpp:419:15: [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. const char *argv[4] = { "unity-control-center", "region", "layouts", NULL }; data/fcitx-qimpanel-2.1.3/config-tool/skin/skinbase.cpp:390:25: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). #define DEFINE_PROPERTY(read, type, property, zero) \ data/fcitx-qimpanel-2.1.3/config-tool/skin/skinbase.cpp:391:45: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). void SkinBase::set##property(const type read) { \ data/fcitx-qimpanel-2.1.3/config-tool/skin/skinbase.cpp:392:23: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). m##property = read; \ data/fcitx-qimpanel-2.1.3/config-tool/skin/skinbase.cpp:394:20: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). type SkinBase::read() const { \ data/fcitx-qimpanel-2.1.3/config-tool/skin/skinbase.cpp:418:29: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). #define DEFINE_SET_PROPERTY(read, type, property) \ data/fcitx-qimpanel-2.1.3/config-tool/skin/skinbase.cpp:419:45: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). void SkinBase::set##property(const type read) { \ data/fcitx-qimpanel-2.1.3/config-tool/skin/skinbase.cpp:420:23: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). m##property = read; \ data/fcitx-qimpanel-2.1.3/config-tool/skin/skinbase.h:305:29: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). #define DEFINE_SET_PROPERTY(read, type, property) \ data/fcitx-qimpanel-2.1.3/config-tool/skin/skinbase.h:306:35: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). void set##property(const type read); data/fcitx-qimpanel-2.1.3/main.cpp:72: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). write(fd, buf, strlen(buf)); data/fcitx-qimpanel-2.1.3/main.cpp:80: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). strcpy(filePath + strlen(PREFIX "/share/fcitx-qimpanel/"), fileName); data/fcitx-qimpanel-2.1.3/main.cpp:89: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). strcpy(filePath + strlen(PREFIX "/bin/"), fileName); data/fcitx-qimpanel-2.1.3/skin/skinbase.cpp:361:25: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). #define DEFINE_PROPERTY(read, type, property, zero) \ data/fcitx-qimpanel-2.1.3/skin/skinbase.cpp:362:45: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). void SkinBase::set##property(const type read) { \ data/fcitx-qimpanel-2.1.3/skin/skinbase.cpp:363:23: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). m##property = read; \ data/fcitx-qimpanel-2.1.3/skin/skinbase.cpp:365:20: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). type SkinBase::read() const { \ data/fcitx-qimpanel-2.1.3/skin/skinbase.cpp:389:29: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). #define DEFINE_SET_PROPERTY(read, type, property) \ data/fcitx-qimpanel-2.1.3/skin/skinbase.cpp:390:45: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). void SkinBase::set##property(const type read) { \ data/fcitx-qimpanel-2.1.3/skin/skinbase.cpp:391:23: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). m##property = read; \ data/fcitx-qimpanel-2.1.3/skin/skinbase.h:293:29: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). #define DEFINE_SET_PROPERTY(read, type, property) \ data/fcitx-qimpanel-2.1.3/skin/skinbase.h:294:35: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). void set##property(const type read); data/fcitx-qimpanel-2.1.3/system_tray_menu.cpp:406:41: [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). layout = i->key.mid(strlen("/Fcitx/im/fcitx-keyboard-")); ANALYSIS SUMMARY: Hits = 54 Lines analyzed = 6637 in approximately 0.23 seconds (28521 lines/second) Physical Source Lines of Code (SLOC) = 4995 Hits@level = [0] 4 [1] 22 [2] 10 [3] 1 [4] 19 [5] 2 Hits@level+ = [0+] 58 [1+] 54 [2+] 32 [3+] 22 [4+] 21 [5+] 2 Hits/KSLOC@level+ = [0+] 11.6116 [1+] 10.8108 [2+] 6.40641 [3+] 4.4044 [4+] 4.2042 [5+] 0.4004 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.