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/libucimf-2.3.8/include/imf/graphport.h Examining data/libucimf-2.3.8/include/imf/imf.h Examining data/libucimf-2.3.8/include/imf/type.h Examining data/libucimf-2.3.8/include/imf/widget.h Examining data/libucimf-2.3.8/include/imf/window.h Examining data/libucimf-2.3.8/include/ucimf.h Examining data/libucimf-2.3.8/include/debug.h Examining data/libucimf-2.3.8/display/graphdev.h Examining data/libucimf-2.3.8/display/graphdev.cpp Examining data/libucimf-2.3.8/display/fbdev.cpp Examining data/libucimf-2.3.8/display/fblinear15.cpp Examining data/libucimf-2.3.8/display/fblinear16.cpp Examining data/libucimf-2.3.8/display/fblinear24.cpp Examining data/libucimf-2.3.8/display/fblinear32.cpp Examining data/libucimf-2.3.8/display/fblinear4.cpp Examining data/libucimf-2.3.8/display/fblinear8.cpp Examining data/libucimf-2.3.8/display/fbvgaplanes.cpp Examining data/libucimf-2.3.8/display/lrmi.c Examining data/libucimf-2.3.8/display/vgadev.cpp Examining data/libucimf-2.3.8/display/fbdev.h Examining data/libucimf-2.3.8/display/fblinear15.h Examining data/libucimf-2.3.8/display/fblinear16.h Examining data/libucimf-2.3.8/display/fblinear24.h Examining data/libucimf-2.3.8/display/fblinear32.h Examining data/libucimf-2.3.8/display/fblinear4.h Examining data/libucimf-2.3.8/display/fblinear8.h Examining data/libucimf-2.3.8/display/fbvgaplanes.h Examining data/libucimf-2.3.8/display/lrmi.h Examining data/libucimf-2.3.8/display/vgadev.h Examining data/libucimf-2.3.8/font/font.h Examining data/libucimf-2.3.8/font/font.cpp Examining data/libucimf-2.3.8/font/main-c.c Examining data/libucimf-2.3.8/font/main-cpp.cpp Examining data/libucimf-2.3.8/src/cwm.h Examining data/libucimf-2.3.8/src/shape.h Examining data/libucimf-2.3.8/src/options.h Examining data/libucimf-2.3.8/src/options.cpp Examining data/libucimf-2.3.8/src/type.cpp Examining data/libucimf-2.3.8/src/graphport.cpp Examining data/libucimf-2.3.8/src/window.cpp Examining data/libucimf-2.3.8/src/widget.cpp Examining data/libucimf-2.3.8/src/shape.cpp Examining data/libucimf-2.3.8/src/cwm.cpp Examining data/libucimf-2.3.8/src/ucimf.cpp Examining data/libucimf-2.3.8/sample/imf/dummy.cpp Examining data/libucimf-2.3.8/sample/imf/dummy.h Examining data/libucimf-2.3.8/sample/term/console01.cpp Examining data/libucimf-2.3.8/sample/term/console04.cpp FINAL RESULTS: data/libucimf-2.3.8/src/options.cpp:51:8: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if ( access(conf.c_str(), R_OK ) != 0 ) data/libucimf-2.3.8/src/options.cpp:58:8: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if ( access(conf.c_str(), R_OK ) != 0 ) data/libucimf-2.3.8/src/ucimf.cpp:356:2: [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( str, keysym_to_term_string(sym, down) ); data/libucimf-2.3.8/src/options.cpp:47:17: [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. string conf = getenv("HOME"); data/libucimf-2.3.8/src/ucimf.cpp:222:40: [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. snprintf(name, sizeof(name), "%s/%s", getenv("HOME"), ".ucimf-log"); data/libucimf-2.3.8/display/fbdev.cpp:76: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 devname[MAX_DEV_LEN+1]; data/libucimf-2.3.8/display/fbdev.cpp:80: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(devname, "/dev/fb%d", fbNo); data/libucimf-2.3.8/display/fbdev.cpp:81:15: [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). mFd = open(devname, O_RDWR); data/libucimf-2.3.8/display/fbdev.cpp:83: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(devname, "/dev/fb/%d", fbNo); data/libucimf-2.3.8/display/fbdev.cpp:84:15: [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). mFd = open(devname, O_RDWR); data/libucimf-2.3.8/display/fbdev.cpp:226:16: [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 ((mFd = open("/dev/vga", O_RDWR | O_NDELAY)) < 0) { data/libucimf-2.3.8/display/lrmi.c:62:12: [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). fd_zero = open("/dev/zero", O_RDONLY); data/libucimf-2.3.8/display/lrmi.c:240:11: [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). fd_mem = open("/dev/mem", O_RDWR); data/libucimf-2.3.8/display/lrmi.c:285: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. ((unsigned char *)m)[0] = 0xcd; /* int opcode */ data/libucimf-2.3.8/display/lrmi.c:286: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. ((unsigned char *)m)[1] = RETURN_TO_32_INT; data/libucimf-2.3.8/display/vgadev.cpp:66:16: [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 ((mFd = open("/dev/mem", O_RDWR)) < 0) { data/libucimf-2.3.8/font/font.cpp:202:3: [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( mFontNames, font_names, font_names_len ); data/libucimf-2.3.8/src/type.cpp:74:3: [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 tmp2[256]; data/libucimf-2.3.8/src/ucimf.cpp:95: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/libucimf-2.3.8/src/ucimf.cpp:96: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/libucimf-2.3.8/src/ucimf.cpp:206:18: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). int font_size = atoi( option->getOption("font-size") ); data/libucimf-2.3.8/src/ucimf.cpp:221:2: [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 name[64]; data/libucimf-2.3.8/src/ucimf.cpp:225:10: [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). LogFd = open(name, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR); data/libucimf-2.3.8/src/ucimf.cpp:355:2: [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 str[128]; data/libucimf-2.3.8/src/widget.cpp:88:14: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). bg_color = atoi( option->getOption("STATUS_BG_COLOR") ); data/libucimf-2.3.8/src/widget.cpp:89:14: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). fg_color = atoi( option->getOption("STATUS_FG_COLOR") ); data/libucimf-2.3.8/src/widget.cpp:90:18: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). border_color = atoi( option->getOption("STATUS_BORDER_COLOR") ); data/libucimf-2.3.8/src/widget.cpp:211:14: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). bg_color = atoi( option->getOption("PREEDIT_BG_COLOR") ); data/libucimf-2.3.8/src/widget.cpp:212:14: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). fg_color = atoi( option->getOption("PREEDIT_FG_COLOR") ); data/libucimf-2.3.8/src/widget.cpp:213:18: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). border_color = atoi( option->getOption("PREEDIT_BORDER_COLOR") ); data/libucimf-2.3.8/src/widget.cpp:300:14: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). bg_color = atoi( option->getOption("LOOKUPCHOICE_BG_COLOR") ); data/libucimf-2.3.8/src/widget.cpp:301:14: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). fg_color = atoi( option->getOption("LOOKUPCHOICE_FG_COLOR") ); data/libucimf-2.3.8/src/widget.cpp:302:18: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). border_color = atoi( option->getOption("LOOKUPCHOICE_BORDER_COLOR") ); data/libucimf-2.3.8/font/font.cpp:200: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 font_names_len = strlen( font_names ); data/libucimf-2.3.8/sample/term/console04.cpp:54:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(0, buf, BUF_SIZE); data/libucimf-2.3.8/src/type.cpp:39: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). size_t inbytesleft = sizeof(char) * strlen(data); data/libucimf-2.3.8/src/ucimf.cpp:317:5: [1] (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). Risk is low because the source is a constant character. strcpy(buf,""); data/libucimf-2.3.8/src/ucimf.cpp:428:2: [1] (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). Risk is low because the source is a constant character. strcpy(buf,""); data/libucimf-2.3.8/src/ucimf.cpp:632: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). index = strlen(buf); ANALYSIS SUMMARY: Hits = 39 Lines analyzed = 6813 in approximately 0.20 seconds (34305 lines/second) Physical Source Lines of Code (SLOC) = 4555 Hits@level = [0] 28 [1] 6 [2] 28 [3] 2 [4] 3 [5] 0 Hits@level+ = [0+] 67 [1+] 39 [2+] 33 [3+] 5 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 14.7091 [1+] 8.56202 [2+] 7.24479 [3+] 1.09769 [4+] 0.658617 [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.