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/mokomaze-0.7.1/src/gui/gui_font.h Examining data/mokomaze-0.7.1/src/gui/gui_settings.cpp Examining data/mokomaze-0.7.1/src/gui/gui_settings.h Examining data/mokomaze-0.7.1/src/gui/gui_msgbox.h Examining data/mokomaze-0.7.1/src/gui/gui_msgbox.cpp Examining data/mokomaze-0.7.1/src/gui/gui_font.cpp Examining data/mokomaze-0.7.1/src/matrix.c Examining data/mokomaze-0.7.1/src/types.h Examining data/mokomaze-0.7.1/src/misc/IMG_SavePNG.c Examining data/mokomaze-0.7.1/src/misc/IMG_SavePNG.h Examining data/mokomaze-0.7.1/src/logging.h Examining data/mokomaze-0.7.1/src/logging.c Examining data/mokomaze-0.7.1/src/matrix.h Examining data/mokomaze-0.7.1/src/main.c Examining data/mokomaze-0.7.1/src/render.h Examining data/mokomaze-0.7.1/src/paramsloader.h Examining data/mokomaze-0.7.1/src/fonts.h Examining data/mokomaze-0.7.1/src/mainwindow.c Examining data/mokomaze-0.7.1/src/input/input_calibration.c Examining data/mokomaze-0.7.1/src/input/input_accel.c Examining data/mokomaze-0.7.1/src/input/input_calibration.h Examining data/mokomaze-0.7.1/src/input/input_joystick.c Examining data/mokomaze-0.7.1/src/input/inputtypes.h Examining data/mokomaze-0.7.1/src/input/input_keyboard.h Examining data/mokomaze-0.7.1/src/input/input_joystick_sdl.h Examining data/mokomaze-0.7.1/src/input/input_joystick.h Examining data/mokomaze-0.7.1/src/input/input.h Examining data/mokomaze-0.7.1/src/input/input_accel.h Examining data/mokomaze-0.7.1/src/input/input_dummy.h Examining data/mokomaze-0.7.1/src/input/input_keyboard.c Examining data/mokomaze-0.7.1/src/input/input_joystick_sdl.c Examining data/mokomaze-0.7.1/src/input/input_dummy.c Examining data/mokomaze-0.7.1/src/vibro/vibro_dummy.h Examining data/mokomaze-0.7.1/src/vibro/vibro_freerunner.h Examining data/mokomaze-0.7.1/src/vibro/vibro_freerunner.c Examining data/mokomaze-0.7.1/src/vibro/vibro_dummy.c Examining data/mokomaze-0.7.1/src/vibro/vibrotypes.h Examining data/mokomaze-0.7.1/src/vibro/vibro.h Examining data/mokomaze-0.7.1/src/mainwindow.h Examining data/mokomaze-0.7.1/src/paramsloader.c Examining data/mokomaze-0.7.1/src/render.c Examining data/mokomaze-0.7.1/src/mazecore/mazehelpers.c Examining data/mokomaze-0.7.1/src/mazecore/mazecore.h Examining data/mokomaze-0.7.1/src/mazecore/mazetypes.h Examining data/mokomaze-0.7.1/src/mazecore/mazehelpers.h Examining data/mokomaze-0.7.1/src/mazecore/mazecore.c Examining data/mokomaze-0.7.1/src/dirs.h FINAL RESULTS: data/mokomaze-0.7.1/src/logging.c:60:5: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stream, fmt, list); data/mokomaze-0.7.1/src/mainwindow.c:104:13: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(cached_file_full, "%s/%s", cache_dir_full, entry->d_name); data/mokomaze-0.7.1/src/mainwindow.c:172:13: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(cached_file_full, "%s/%s_%x-%dx%d-%s.png", cache_dir_full, file, mod_time, res_width, res_height, state); data/mokomaze-0.7.1/src/mainwindow.c:173:13: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(file_hash, "%s_%x", file, mod_time); data/mokomaze-0.7.1/src/paramsloader.c:437:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(save_dir_full, "%s/%s", pHome, SAVE_DIR); data/mokomaze-0.7.1/src/paramsloader.c:439:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(cache_dir_full, "%s/%s", save_dir_full, CACHE_DIR); data/mokomaze-0.7.1/src/paramsloader.c:441:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(save_file_full, "%s/%s", save_dir_full, SAVE_FILE); data/mokomaze-0.7.1/src/paramsloader.c:426: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 *pHome = getenv("HOME"); data/mokomaze-0.7.1/src/gui/gui_font.cpp:49: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 sample_text[2] = {0}; data/mokomaze-0.7.1/src/gui/gui_settings.cpp:236: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 buf[32]; data/mokomaze-0.7.1/src/gui/gui_settings.cpp:238: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(buf, "%d", val); data/mokomaze-0.7.1/src/gui/gui_settings.cpp:249: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 buf[32]; data/mokomaze-0.7.1/src/gui/gui_settings.cpp:251: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(buf, "%.2f", val); data/mokomaze-0.7.1/src/input/input_accel.c:69:18: [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(params.fname, O_RDONLY, O_NONBLOCK); data/mokomaze-0.7.1/src/input/input_joystick.c:47:18: [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(params.fname, O_RDONLY); data/mokomaze-0.7.1/src/mainwindow.c:946: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 txt[32]; data/mokomaze-0.7.1/src/mainwindow.c:947:13: [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(txt, "Level %d/%d", cur_level + 1, game_levels_count); data/mokomaze-0.7.1/src/vibro/vibro_freerunner.c:36:14: [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). fvibro = fopen("/sys/class/leds/gta02::vibrator/brightness", "w"); data/mokomaze-0.7.1/src/vibro/vibro_freerunner.c:39:14: [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). fvibro = fopen("/sys/devices/platform/leds_pwm/leds/gta02::vibrator/brightness", "w"); data/mokomaze-0.7.1/src/vibro/vibro_freerunner.c:42:14: [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). fvibro = fopen("/sys/class/leds/neo1973:vibrator/brightness", "w"); data/mokomaze-0.7.1/src/vibro/vibro_freerunner.c:45:14: [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). fvibro = fopen("/sys/devices/platform/neo1973-vibrator.0/leds/neo1973:vibrator/brightness", "w"); data/mokomaze-0.7.1/src/input/input_accel.c:95:24: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). rval = read(fd, &ev, sizeof(ev)); data/mokomaze-0.7.1/src/input/input_joystick.c:71:24: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). rval = read(fd, &js, sizeof(js)); data/mokomaze-0.7.1/src/input/inputtypes.h:30:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). void (*read)(float *x, float *y, float *z); data/mokomaze-0.7.1/src/mainwindow.c:101:43: [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 (!strncmp(entry->d_name, file, strlen(file)) && strncmp(entry->d_name, file_hash, strlen(file_hash))) data/mokomaze-0.7.1/src/mainwindow.c:101:94: [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 (!strncmp(entry->d_name, file, strlen(file)) && strncmp(entry->d_name, file_hash, strlen(file_hash))) data/mokomaze-0.7.1/src/mainwindow.c:103:52: [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). char *cached_file_full = (char*)malloc(strlen(cache_dir_full) + strlen("/") + strlen(entry->d_name) + 1); data/mokomaze-0.7.1/src/mainwindow.c:103:77: [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). char *cached_file_full = (char*)malloc(strlen(cache_dir_full) + strlen("/") + strlen(entry->d_name) + 1); data/mokomaze-0.7.1/src/mainwindow.c:103:91: [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). char *cached_file_full = (char*)malloc(strlen(cache_dir_full) + strlen("/") + strlen(entry->d_name) + 1); data/mokomaze-0.7.1/src/mainwindow.c:168:46: [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). cached_file_full = (char*)malloc(strlen(cache_dir_full) + strlen("/") + strlen(file) + max_overhead + 1); data/mokomaze-0.7.1/src/mainwindow.c:168:71: [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). cached_file_full = (char*)malloc(strlen(cache_dir_full) + strlen("/") + strlen(file) + max_overhead + 1); data/mokomaze-0.7.1/src/mainwindow.c:168:85: [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). cached_file_full = (char*)malloc(strlen(cache_dir_full) + strlen("/") + strlen(file) + max_overhead + 1); data/mokomaze-0.7.1/src/mainwindow.c:169: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). file_hash = (char*)malloc(strlen(file) + max_overhead + 1); data/mokomaze-0.7.1/src/mainwindow.c:867:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). input.read(&acx, &acy, NULL); data/mokomaze-0.7.1/src/paramsloader.c:436: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). save_dir_full = (char*)malloc(strlen(pHome) + strlen("/") + strlen(SAVE_DIR) + 1); data/mokomaze-0.7.1/src/paramsloader.c:436:55: [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). save_dir_full = (char*)malloc(strlen(pHome) + strlen("/") + strlen(SAVE_DIR) + 1); data/mokomaze-0.7.1/src/paramsloader.c:436:69: [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). save_dir_full = (char*)malloc(strlen(pHome) + strlen("/") + strlen(SAVE_DIR) + 1); data/mokomaze-0.7.1/src/paramsloader.c:438: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). cache_dir_full = (char*)malloc(strlen(save_dir_full) + strlen("/") + strlen(CACHE_DIR) + 1); data/mokomaze-0.7.1/src/paramsloader.c:438:64: [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). cache_dir_full = (char*)malloc(strlen(save_dir_full) + strlen("/") + strlen(CACHE_DIR) + 1); data/mokomaze-0.7.1/src/paramsloader.c:438:78: [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). cache_dir_full = (char*)malloc(strlen(save_dir_full) + strlen("/") + strlen(CACHE_DIR) + 1); data/mokomaze-0.7.1/src/paramsloader.c:440: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). save_file_full = (char*)malloc(strlen(save_dir_full) + strlen("/") + strlen(SAVE_FILE) + 1); data/mokomaze-0.7.1/src/paramsloader.c:440:64: [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). save_file_full = (char*)malloc(strlen(save_dir_full) + strlen("/") + strlen(SAVE_FILE) + 1); data/mokomaze-0.7.1/src/paramsloader.c:440:78: [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). save_file_full = (char*)malloc(strlen(save_dir_full) + strlen("/") + strlen(SAVE_FILE) + 1); ANALYSIS SUMMARY: Hits = 43 Lines analyzed = 6812 in approximately 0.20 seconds (34250 lines/second) Physical Source Lines of Code (SLOC) = 4830 Hits@level = [0] 11 [1] 22 [2] 13 [3] 1 [4] 7 [5] 0 Hits@level+ = [0+] 54 [1+] 43 [2+] 21 [3+] 8 [4+] 7 [5+] 0 Hits/KSLOC@level+ = [0+] 11.1801 [1+] 8.90269 [2+] 4.34783 [3+] 1.65631 [4+] 1.44928 [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.