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/tomatoes-1.55/src/trap.cpp Examining data/tomatoes-1.55/src/effects.cpp Examining data/tomatoes-1.55/src/timer.cpp Examining data/tomatoes-1.55/src/font.cpp Examining data/tomatoes-1.55/src/particle.cpp Examining data/tomatoes-1.55/src/tilemap.cpp Examining data/tomatoes-1.55/src/main.cpp Examining data/tomatoes-1.55/src/helpers.cpp Examining data/tomatoes-1.55/src/special_power.cpp Examining data/tomatoes-1.55/src/screenshot.cpp Examining data/tomatoes-1.55/src/mpak.cpp Examining data/tomatoes-1.55/src/mymath.cpp Examining data/tomatoes-1.55/src/enemy.cpp Examining data/tomatoes-1.55/src/teleport.cpp Examining data/tomatoes-1.55/src/comments.cpp Examining data/tomatoes-1.55/src/texture.cpp Examining data/tomatoes-1.55/src/pathfinder.cpp Examining data/tomatoes-1.55/src/levels.cpp Examining data/tomatoes-1.55/src/bomb.cpp Examining data/tomatoes-1.55/src/init.cpp Examining data/tomatoes-1.55/src/bonus.cpp Examining data/tomatoes-1.55/src/player.cpp Examining data/tomatoes-1.55/src/config.cpp Examining data/tomatoes-1.55/src/game.cpp Examining data/tomatoes-1.55/src/hiscore.cpp Examining data/tomatoes-1.55/src/menu.cpp Examining data/tomatoes-1.55/src/select_special.cpp Examining data/tomatoes-1.55/src/soundmusic.cpp Examining data/tomatoes-1.55/include/pathfinder.h Examining data/tomatoes-1.55/include/special_power.h Examining data/tomatoes-1.55/include/tilemap.h Examining data/tomatoes-1.55/include/particle.h Examining data/tomatoes-1.55/include/enemy.h Examining data/tomatoes-1.55/include/timer.h Examining data/tomatoes-1.55/include/bomb.h Examining data/tomatoes-1.55/include/game.h Examining data/tomatoes-1.55/include/font.h Examining data/tomatoes-1.55/include/levels.h Examining data/tomatoes-1.55/include/init.h Examining data/tomatoes-1.55/include/menu.h Examining data/tomatoes-1.55/include/mpak.h Examining data/tomatoes-1.55/include/bgrounds.h Examining data/tomatoes-1.55/include/texture.h Examining data/tomatoes-1.55/include/trap.h Examining data/tomatoes-1.55/include/vect.h Examining data/tomatoes-1.55/include/select_special.h Examining data/tomatoes-1.55/include/player.h Examining data/tomatoes-1.55/include/comments.h Examining data/tomatoes-1.55/include/effects.h Examining data/tomatoes-1.55/include/teleport.h Examining data/tomatoes-1.55/include/screenshot.h Examining data/tomatoes-1.55/include/soundmusic.h Examining data/tomatoes-1.55/include/mymath.h Examining data/tomatoes-1.55/include/bonus.h Examining data/tomatoes-1.55/include/helpers.h Examining data/tomatoes-1.55/include/config.h Examining data/tomatoes-1.55/include/hiscore.h FINAL RESULTS: data/tomatoes-1.55/src/comments.cpp:58:2: [4] (format) vsprintf: Potential format string problem (CWE-134). Make format string constant. vsprintf(buf, str, args); data/tomatoes-1.55/src/comments.cpp:104: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(text, str); data/tomatoes-1.55/src/comments.cpp:113: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(text, from.text); data/tomatoes-1.55/src/font.cpp:62:2: [4] (format) vsprintf: Potential format string problem (CWE-134). Make format string constant. vsprintf(buf, string, args); data/tomatoes-1.55/src/font.cpp:80:2: [4] (format) vsprintf: Potential format string problem (CWE-134). Make format string constant. vsprintf(buf, string, args); data/tomatoes-1.55/src/font.cpp:106:2: [4] (format) vsprintf: Potential format string problem (CWE-134). Make format string constant. vsprintf(buf, string, args); data/tomatoes-1.55/src/hiscore.cpp:454: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(list[NUM_NAMES-1].name, name); data/tomatoes-1.55/src/init.cpp:68:2: [4] (format) vsprintf: Potential format string problem (CWE-134). Make format string constant. vsprintf(buf, msg, ap); data/tomatoes-1.55/src/mpak.cpp:242: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(mpk_file, file); data/tomatoes-1.55/src/mpak.cpp:329:4: [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(override_dir, override); data/tomatoes-1.55/src/mpak.cpp:425: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(files[cur], mpk_strip_path(file)); data/tomatoes-1.55/src/mpak.cpp:463:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(testfile, "%s%s", override_dir, file); data/tomatoes-1.55/src/mpak.cpp:514:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(file_out, "%s/%s", path, file); data/tomatoes-1.55/src/mpak.cpp:516:3: [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(file_out, file); data/tomatoes-1.55/src/screenshot.cpp:77:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(temp, "%sscreenshot%03d.tga", get_tomatoes_dir().c_str(), num); data/tomatoes-1.55/src/screenshot.cpp:80:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(temp, "%sscreenshot%03d.tga", get_tomatoes_dir().c_str(), num); data/tomatoes-1.55/src/screenshot.cpp:83:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(temp, "%sscreenshot%03d.tga", CONFIG_DIR, num); data/tomatoes-1.55/src/screenshot.cpp:86:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(temp, "%sscreenshot%03d.tga", CONFIG_DIR, num); data/tomatoes-1.55/src/soundmusic.cpp:68:3: [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(swap, music_files[i]); data/tomatoes-1.55/src/soundmusic.cpp:69:3: [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(music_files[i], music_files[pos]); data/tomatoes-1.55/src/soundmusic.cpp:70:3: [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(music_files[pos], swap); data/tomatoes-1.55/src/soundmusic.cpp:104:3: [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(name, ep->d_name); data/tomatoes-1.55/src/soundmusic.cpp:112: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(music_files[num_music_files], name); data/tomatoes-1.55/src/soundmusic.cpp:118: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(music_files[num_music_files], name); data/tomatoes-1.55/src/soundmusic.cpp:124: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(music_files[num_music_files], name); data/tomatoes-1.55/src/soundmusic.cpp:130: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(music_files[num_music_files], name); data/tomatoes-1.55/src/soundmusic.cpp:136: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(music_files[num_music_files], name); data/tomatoes-1.55/src/soundmusic.cpp:177:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(soundfile, "%s%s", pakfile.override_dir, file); data/tomatoes-1.55/src/soundmusic.cpp:271:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(str, "%s%s", MUSIC_DIR, file); data/tomatoes-1.55/src/config.cpp:49:15: [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 *home = getenv("HOME"); data/tomatoes-1.55/src/mymath.cpp:57:2: [3] (random) srand: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srand(time(NULL)); data/tomatoes-1.55/include/comments.h:48: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 text[256]; // Comment text data/tomatoes-1.55/include/hiscore.h:47: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[NAME_LEN]; // Name data/tomatoes-1.55/include/mpak.h:76: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 override_dir[64]; // Name of the override directory data/tomatoes-1.55/include/mpak.h:78: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 mpk_file[64]; // Filename of the open MPK file data/tomatoes-1.55/include/mpak.h:81: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 files[MPAK_MAX_FILES][64]; // File names data/tomatoes-1.55/include/soundmusic.h:43: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. extern char music_files[MAX_MUSIC][256]; data/tomatoes-1.55/src/comments.cpp:55: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 buf[256]; data/tomatoes-1.55/src/config.cpp:86:17: [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). FILE *ftest = fopen(tmp.c_str(), "rt"); data/tomatoes-1.55/src/config.cpp:105:19: [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). FILE *f = fopen(file.c_str(), "rt"); data/tomatoes-1.55/src/config.cpp:132:18: [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). FILE *f = fopen(file.c_str(), "wt"); data/tomatoes-1.55/src/font.cpp:59: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 buf[1024]; data/tomatoes-1.55/src/font.cpp:77: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 buf[1024]; data/tomatoes-1.55/src/font.cpp:103: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 buf[1024]; data/tomatoes-1.55/src/game.cpp:228: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[10] = ""; data/tomatoes-1.55/src/game.cpp:229:2: [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(str, "%4d", kill_count); data/tomatoes-1.55/src/game.cpp:233:2: [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(str, "%2d", num_seconds_left); data/tomatoes-1.55/src/hiscore.cpp:83:17: [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). FILE *ftest = fopen(tmp.c_str(), "rb"); data/tomatoes-1.55/src/hiscore.cpp:406:16: [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). fout = fopen(file.c_str(), "wb"); data/tomatoes-1.55/src/hiscore.cpp:426:15: [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). fin = fopen(file.c_str(), "rb"); data/tomatoes-1.55/src/hiscore.cpp:496:3: [2] (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 string. strcpy(list[f].name, "- - - - - - - - - -"); data/tomatoes-1.55/src/levels.cpp:66: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 level_names[NUM_LEVELS][16] = { "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten" }; data/tomatoes-1.55/src/levels.cpp:102: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 str[128] = ""; data/tomatoes-1.55/src/levels.cpp:103:3: [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(str, "MAP%02d.map", num_level_files+1); data/tomatoes-1.55/src/levels.cpp:165: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/tomatoes-1.55/src/levels.cpp:166:2: [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(str, "MAP%02d.map", num+1); data/tomatoes-1.55/src/levels.cpp:173: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/tomatoes-1.55/src/levels.cpp:174:2: [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(str, "bg%02d.jpg", num+1); data/tomatoes-1.55/src/menu.cpp:103:10: [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 buf[32]; data/tomatoes-1.55/src/mpak.cpp:110: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). FILE *fin = fopen(file, "rb"); data/tomatoes-1.55/src/mpak.cpp:119: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 buffer[16384]; data/tomatoes-1.55/src/mpak.cpp:198:2: [2] (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 string. strcpy(mpk_file, "null"); data/tomatoes-1.55/src/mpak.cpp:199:2: [2] (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 string. strcpy(override_dir, "null"); data/tomatoes-1.55/src/mpak.cpp:235: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). fpointer = fopen(file, (mode == MPAK_READ) ? "rb" : "wb"); data/tomatoes-1.55/src/mpak.cpp:243:2: [2] (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 string. strcpy(override_dir, "null"); data/tomatoes-1.55/src/mpak.cpp:265: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 id[5] = ""; data/tomatoes-1.55/src/mpak.cpp:412: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). FILE *fin = fopen(file, "rb"); data/tomatoes-1.55/src/mpak.cpp:431: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 buffer[16384]; data/tomatoes-1.55/src/mpak.cpp:462: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 testfile[256] = ""; data/tomatoes-1.55/src/mpak.cpp:464:16: [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). FILE *test = fopen(testfile, "rb"); data/tomatoes-1.55/src/mpak.cpp:482:19: [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). FILE *pointer = fopen(mpk_file, "rb"); data/tomatoes-1.55/src/mpak.cpp:512: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 file_out[256] = ""; data/tomatoes-1.55/src/mpak.cpp:519:15: [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). FILE *fout = fopen(file_out, "wb"); data/tomatoes-1.55/src/mpak.cpp:526: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 buffer[16384]; data/tomatoes-1.55/src/screenshot.cpp:54:12: [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). FILE *f = fopen(file, "rb"); data/tomatoes-1.55/src/screenshot.cpp:68: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 temp[512] = ""; data/tomatoes-1.55/src/screenshot.cpp:121:9: [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). file = fopen(filename, "wb"); data/tomatoes-1.55/src/select_special.cpp:71:7: [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 icon_names[NUM_ICONS][128] = { "Trap", "Wild Fire", "Napalm Strike", "Will O' The Wisp", "Potato Man", "Flower Power", "Teleport", "Turn", "Lightning Bolt" }; data/tomatoes-1.55/src/select_special.cpp:200: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 str[5] = ""; data/tomatoes-1.55/src/select_special.cpp:201:3: [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(str, "%2d", icon_menu.count[f]); data/tomatoes-1.55/src/soundmusic.cpp:49: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 music_files[MAX_MUSIC][256]; data/tomatoes-1.55/src/soundmusic.cpp:67: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 swap[256]; data/tomatoes-1.55/src/soundmusic.cpp:102: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 ext[3]; data/tomatoes-1.55/src/soundmusic.cpp:103: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 name[256] = ""; data/tomatoes-1.55/src/soundmusic.cpp:176: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 soundfile[128] = ""; data/tomatoes-1.55/src/soundmusic.cpp:178:16: [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). FILE *check = fopen(soundfile, "rb"); data/tomatoes-1.55/src/soundmusic.cpp:270: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[256] = ""; data/tomatoes-1.55/src/texture.cpp:116: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((Uint8*)line, ((Uint8*)img->pixels + f*img->pitch), img->w*img->format->BytesPerPixel); data/tomatoes-1.55/src/texture.cpp:117: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(((Uint8*)img->pixels + f*img->pitch), ((Uint8*)img->pixels + (img->h - f - 1)*img->pitch), img->w*img->format->BytesPerPixel); data/tomatoes-1.55/src/texture.cpp:118: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(((Uint8*)img->pixels + (img->h - f - 1)*img->pitch), (Uint8*)line, img->w*img->format->BytesPerPixel); data/tomatoes-1.55/src/texture.cpp:215: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((Uint8*)line, ((Uint8*)img->pixels + f*img->pitch), img->w*img->format->BytesPerPixel); data/tomatoes-1.55/src/texture.cpp:216: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(((Uint8*)img->pixels + f*img->pitch), ((Uint8*)img->pixels + (img->h - f - 1)*img->pitch), img->w*img->format->BytesPerPixel); data/tomatoes-1.55/src/texture.cpp:217: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(((Uint8*)img->pixels + (img->h - f - 1)*img->pitch), (Uint8*)line, img->w*img->format->BytesPerPixel); data/tomatoes-1.55/src/tilemap.cpp:77: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 file[128] = ""; data/tomatoes-1.55/src/tilemap.cpp:78:3: [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(file, "maptex%02d.jpg", f+1); data/tomatoes-1.55/src/tilemap.cpp:422:12: [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). FILE *f = fopen(file, "wb"); data/tomatoes-1.55/src/tilemap.cpp:477:12: [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). FILE *f = fopen(file, "rb"); data/tomatoes-1.55/src/tilemap.cpp:483: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 id[3]; data/tomatoes-1.55/src/font.cpp:65:24: [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). float length = (float)strlen(buf)*spacing; data/tomatoes-1.55/src/font.cpp:93:14: [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). glCallLists(strlen(buf), GL_BYTE, buf); data/tomatoes-1.55/src/font.cpp:113:24: [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). float length = (float)strlen(buf)*spacing; data/tomatoes-1.55/src/font.cpp:122:14: [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). glCallLists(strlen(buf), GL_BYTE, buf); data/tomatoes-1.55/src/font.cpp:193:12: [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 len = strlen(string); data/tomatoes-1.55/src/menu.cpp:120:27: [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). for(unsigned int c=0; c<strlen(buf); c++) { data/tomatoes-1.55/src/mpak.cpp:177:12: [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 pos = strlen(path); data/tomatoes-1.55/src/mpak.cpp:201:3: [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(files[f], ""); data/tomatoes-1.55/src/mpak.cpp:266:11: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). id[0] = fgetc(fpointer); data/tomatoes-1.55/src/mpak.cpp:267:11: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). id[1] = fgetc(fpointer); data/tomatoes-1.55/src/mpak.cpp:268:11: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). id[2] = fgetc(fpointer); data/tomatoes-1.55/src/mpak.cpp:269:11: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). id[3] = fgetc(fpointer); data/tomatoes-1.55/src/mpak.cpp:306:14: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int len = fgetc(fpointer); data/tomatoes-1.55/src/mpak.cpp:366:14: [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 len = strlen(files[f])+1; data/tomatoes-1.55/src/soundmusic.cpp:92:3: [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(music_files[f], ""); data/tomatoes-1.55/src/soundmusic.cpp:105: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). int len = strlen(name); data/tomatoes-1.55/src/tilemap.cpp:484:10: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). id[0] = fgetc(f); data/tomatoes-1.55/src/tilemap.cpp:485:10: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). id[1] = fgetc(f); data/tomatoes-1.55/src/tilemap.cpp:486:10: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). id[2] = fgetc(f); data/tomatoes-1.55/src/tilemap.cpp:491:9: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). p1.x = fgetc(f); data/tomatoes-1.55/src/tilemap.cpp:492:9: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). p1.y = fgetc(f); data/tomatoes-1.55/src/tilemap.cpp:499:11: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). p1.dir = fgetc(f); data/tomatoes-1.55/src/tilemap.cpp:504:18: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). teleport_x[0] = fgetc(f) - 1; data/tomatoes-1.55/src/tilemap.cpp:505:18: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). teleport_y[0] = fgetc(f) - 1; data/tomatoes-1.55/src/tilemap.cpp:506:18: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). teleport_x[1] = fgetc(f) - 1; data/tomatoes-1.55/src/tilemap.cpp:507:18: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). teleport_y[1] = fgetc(f) - 1; data/tomatoes-1.55/src/tilemap.cpp:508:20: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). teleport_dir[0] = fgetc(f); data/tomatoes-1.55/src/tilemap.cpp:509:20: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). teleport_dir[1] = fgetc(f); data/tomatoes-1.55/src/tilemap.cpp:512:18: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). tile_roof_tex = fgetc(f); data/tomatoes-1.55/src/tilemap.cpp:519:19: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). map[x][y][0] = fgetc(f); data/tomatoes-1.55/src/tilemap.cpp:520:19: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). map[x][y][1] = fgetc(f); data/tomatoes-1.55/src/tilemap.cpp:523:26: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). teleport_map[x][y] = (fgetc(f)) ? true : false; ANALYSIS SUMMARY: Hits = 130 Lines analyzed = 13706 in approximately 0.35 seconds (38769 lines/second) Physical Source Lines of Code (SLOC) = 7706 Hits@level = [0] 48 [1] 32 [2] 67 [3] 2 [4] 29 [5] 0 Hits@level+ = [0+] 178 [1+] 130 [2+] 98 [3+] 31 [4+] 29 [5+] 0 Hits/KSLOC@level+ = [0+] 23.0989 [1+] 16.87 [2+] 12.7174 [3+] 4.02284 [4+] 3.7633 [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.