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/hex-a-hop-1.1.0+git20140926/src/sfx.h Examining data/hex-a-hop-1.1.0+git20140926/src/state.h Examining data/hex-a-hop-1.1.0+git20140926/src/packfile.h Examining data/hex-a-hop-1.1.0+git20140926/src/gfx.cpp Examining data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp Examining data/hex-a-hop-1.1.0+git20140926/src/system-relative.h Examining data/hex-a-hop-1.1.0+git20140926/src/sfx.cpp Examining data/hex-a-hop-1.1.0+git20140926/src/system-directory.h Examining data/hex-a-hop-1.1.0+git20140926/src/menus.h Examining data/hex-a-hop-1.1.0+git20140926/src/gfx_list.h Examining data/hex-a-hop-1.1.0+git20140926/src/system-relative.c Examining data/hex-a-hop-1.1.0+git20140926/src/i18n.h Examining data/hex-a-hop-1.1.0+git20140926/src/text.h Examining data/hex-a-hop-1.1.0+git20140926/src/savestate.h Examining data/hex-a-hop-1.1.0+git20140926/src/video.h Examining data/hex-a-hop-1.1.0+git20140926/src/level_list.h Examining data/hex-a-hop-1.1.0+git20140926/src/text.cpp Examining data/hex-a-hop-1.1.0+git20140926/src/system-directory.c Examining data/hex-a-hop-1.1.0+git20140926/src/i18n.cpp Examining data/hex-a-hop-1.1.0+git20140926/src/gettext.h Examining data/hex-a-hop-1.1.0+git20140926/src/tiletypes.h FINAL RESULTS: data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:113:4: [5] (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. Risk is high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat(save_path, "/", sizeof(save_path)); data/hex-a-hop-1.1.0+git20140926/src/system-relative.c:80:10: [5] (race) readlink: This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach. size = readlink (tmp, path, buf_size - 1); data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:259: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(filename+i+1, newsuffix); data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:263:3: [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(filename, newsuffix); data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:1488:4: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(tmp1, ngettext("Complete 1 more level to unlock!", "Complete %d more levels to unlock!", t-numComplete), t-numComplete); data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:1825:6: [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(currentFile, filename); data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:1843: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(currentFile, filename); data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:2116: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(special[p.x][p.y], d); data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:2346: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(out, bmp); data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:2799:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tmp, _("Special(%d,%d): %s (%d)"), s.x, s.y, sp ? sp : _("<None>"), GetPar(sp)); data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:2972: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(tmp, x); data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:2974:6: [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(x, GetSpecial(s)); data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:3971: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(tmp, currentFile); data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:4010:6: [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(tmp, currentFile); data/hex-a-hop-1.1.0+git20140926/src/savestate.h:159: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(name, n); data/hex-a-hop-1.1.0+git20140926/src/state.h:59:66: [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). String(String const & s) : len(0), data(NULL) { reserve(s.len); strcpy(data, s.data); } data/hex-a-hop-1.1.0+git20140926/src/state.h:75:62: [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). void operator += (const char * a) { reserve(strlen(a)+len); strcat(data, a); } data/hex-a-hop-1.1.0+git20140926/src/system-directory.c:401: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 (ret, a); data/hex-a-hop-1.1.0+git20140926/src/system-directory.c:404: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 (ret + len0, b); data/hex-a-hop-1.1.0+git20140926/src/text.cpp:281:2: [4] (format) vsnprintf: 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. vsnprintf((char*)tmp, 1000, string, marker); data/hex-a-hop-1.1.0+git20140926/src/text.cpp:296:2: [4] (format) vsnprintf: 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. vsnprintf((char*)tmp, 1000, string, marker); data/hex-a-hop-1.1.0+git20140926/src/text.cpp:337:2: [4] (format) vsnprintf: 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. vsnprintf((char*)tmp, 1000, string, marker); data/hex-a-hop-1.1.0+git20140926/src/text.cpp:385:2: [4] (format) vsprintf: Potential format string problem (CWE-134). Make format string constant. vsprintf((char*)tmp, string, marker); data/hex-a-hop-1.1.0+git20140926/src/text.cpp:401:2: [4] (format) vsprintf: Potential format string problem (CWE-134). Make format string constant. vsprintf((char*)tmp, string, marker); data/hex-a-hop-1.1.0+git20140926/src/text.cpp:432:2: [4] (format) vsprintf: Potential format string problem (CWE-134). Make format string constant. vsprintf((char*)tmp, string, marker); data/hex-a-hop-1.1.0+git20140926/src/text.cpp:463: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_utf8, text_locally_encoded.c_str ()); data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:100:22: [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 *home = getenv("HOME"); data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:777: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(seed); data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:960:5: [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(int(r->seed * 0xfff)); data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:1071:3: [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(seed); data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:1142:3: [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(seed); data/hex-a-hop-1.1.0+git20140926/src/sfx.cpp:87:3: [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/hex-a-hop-1.1.0+git20140926/src/gettext.h:201: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 msg_ctxt_id[msgctxt_len + msgid_len]; data/hex-a-hop-1.1.0+git20140926/src/gettext.h:203: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 buf[1024]; data/hex-a-hop-1.1.0+git20140926/src/gettext.h:211:7: [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 (msg_ctxt_id, msgctxt, msgctxt_len - 1); data/hex-a-hop-1.1.0+git20140926/src/gettext.h:213:7: [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 (msg_ctxt_id + msgctxt_len, msgid, msgid_len); data/hex-a-hop-1.1.0+git20140926/src/gettext.h:247: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 msg_ctxt_id[msgctxt_len + msgid_len]; data/hex-a-hop-1.1.0+git20140926/src/gettext.h:249: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 buf[1024]; data/hex-a-hop-1.1.0+git20140926/src/gettext.h:257:7: [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 (msg_ctxt_id, msgctxt, msgctxt_len - 1); data/hex-a-hop-1.1.0+git20140926/src/gettext.h:259:7: [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 (msg_ctxt_id + msgctxt_len, msgid, msgid_len); data/hex-a-hop-1.1.0+git20140926/src/gfx.cpp:58: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 filename[1025] = ""; data/hex-a-hop-1.1.0+git20140926/src/gfx.cpp:59: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 path[1025] = "C:\\WINDOWS\\Desktop\\New Folder\\Foo\\Levels"; data/hex-a-hop-1.1.0+git20140926/src/gfx.cpp:60: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 backupPath[1025]; data/hex-a-hop-1.1.0+git20140926/src/gfx.cpp:88:6: [2] (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). Risk is low because the source is a constant string. strcat(filename, ".lev"); data/hex-a-hop-1.1.0+git20140926/src/gfx.cpp:90:6: [2] (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). Risk is low because the source is a constant string. strcat(filename, ".sol"); data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:108:4: [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 save_path[PATH_MAX]; data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:131: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( filename, flags ); data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:1466: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 currentFile[1000]; data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:1482:12: [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 t = atoi(f+1); data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:1486:11: [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 tmp1[1000]; data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:1514: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 bounds[4]; data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:1754: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(d, loadPtr, size*num); data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:1931: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 bounds[4]; data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:2184:17: [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 target = atoi(x+1), targetM = 0; data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:2210:20: [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). lsr->magic = -atoi(x+1); data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:2345:4: [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 out[1024]; data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:2347:4: [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(strstr(out, ".bmp"), ".dat"); data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:2777:4: [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[1000]; data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:2968:11: [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 x[1000] = ""; data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:2971: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[1000]; data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:3970: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[1000]; data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:4009:6: [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[1000]; data/hex-a-hop-1.1.0+git20140926/src/menus.h:161: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 title[500]; data/hex-a-hop-1.1.0+git20140926/src/menus.h:197:4: [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(title, _("Info:")); data/hex-a-hop-1.1.0+git20140926/src/menus.h:205: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 msg_utf8[5000]; data/hex-a-hop-1.1.0+git20140926/src/menus.h:337: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 (title, _("Help (Page --)"), page_display+1, page_count); data/hex-a-hop-1.1.0+git20140926/src/menus.h:339: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 (title, _("Help (Page %d/%d)"), page_display+1, page_count); data/hex-a-hop-1.1.0+git20140926/src/menus.h:414: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 optionSlotName[MAX_GAMESLOT][400] = { {0} }; data/hex-a-hop-1.1.0+git20140926/src/menus.h:415: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 currentSlot[800] = ""; data/hex-a-hop-1.1.0+git20140926/src/menus.h:419: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(t, "save%d.dat", i+1); data/hex-a-hop-1.1.0+git20140926/src/menus.h:892:24: [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). RenderTile(false, atoi(xx+1), (xl+x)/2+scrollX, y+FONT_SPACING/2+scrollY); data/hex-a-hop-1.1.0+git20140926/src/menus.h:893:24: [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). RenderTile(false, atoi(strchr(xx, ',')+1), (xr+x)/2+scrollX, y+FONT_SPACING/2+scrollY); data/hex-a-hop-1.1.0+git20140926/src/menus.h:981:4: [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[80]; data/hex-a-hop-1.1.0+git20140926/src/menus.h:990:6: [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(optionSlotName[i], _("Continue game %d (All Clear!)"), i+1); data/hex-a-hop-1.1.0+git20140926/src/menus.h:992:6: [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(optionSlotName[i], _("Continue game %d (%d%% + %d%%)"), i+1, p.general.completionPercentage, p.general.masteredPercentage); data/hex-a-hop-1.1.0+git20140926/src/menus.h:994:6: [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(optionSlotName[i], _("Continue game %d (%d%% complete)"), i+1, p.general.completionPercentage); data/hex-a-hop-1.1.0+git20140926/src/menus.h:1034: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 tmp[800]; data/hex-a-hop-1.1.0+git20140926/src/menus.h:1040: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(tmp, _("Really delete game %d?"), num+1); data/hex-a-hop-1.1.0+git20140926/src/packfile.h:48: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[1]; data/hex-a-hop-1.1.0+git20140926/src/savestate.h:272:6: [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[1000]; data/hex-a-hop-1.1.0+git20140926/src/system-relative.c:110:7: [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). f = fopen ("/proc/self/maps", "r"); data/hex-a-hop-1.1.0+git20140926/src/system-relative.c:153: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[MAX_PATH]; data/hex-a-hop-1.1.0+git20140926/src/system-relative.c:201: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 path[1024]; data/hex-a-hop-1.1.0+git20140926/src/text.cpp:105: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 tmp[5000]; data/hex-a-hop-1.1.0+git20140926/src/text.cpp:280: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 tmp[1000]; data/hex-a-hop-1.1.0+git20140926/src/text.cpp:295: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 tmp[1000]; data/hex-a-hop-1.1.0+git20140926/src/text.cpp:312: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 tmp_utf8[5000]; // FIXME: Check this limit data/hex-a-hop-1.1.0+git20140926/src/text.cpp:336: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 tmp[1000]; data/hex-a-hop-1.1.0+git20140926/src/text.cpp:384: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 tmp[1000], tmp_utf8[5000]; // FIXME: Check this limit data/hex-a-hop-1.1.0+git20140926/src/text.cpp:400: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 tmp[1000], tmp_utf8[5000]; // FIXME: Check this limit data/hex-a-hop-1.1.0+git20140926/src/text.cpp:415: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 tmp_utf8[5000]; // FIXME: Check this limit data/hex-a-hop-1.1.0+git20140926/src/text.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 tmp[1000]; // FIXME: Check this limit data/hex-a-hop-1.1.0+git20140926/src/gettext.h:197: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). size_t msgctxt_len = strlen (msgctxt) + 1; data/hex-a-hop-1.1.0+git20140926/src/gettext.h:198:22: [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 msgid_len = strlen (msgid) + 1; data/hex-a-hop-1.1.0+git20140926/src/gettext.h:243: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). size_t msgctxt_len = strlen (msgctxt) + 1; data/hex-a-hop-1.1.0+git20140926/src/gettext.h:244:22: [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 msgid_len = strlen (msgid) + 1; data/hex-a-hop-1.1.0+git20140926/src/gfx.cpp:85: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 i = strlen(filename)-1; data/hex-a-hop-1.1.0+git20140926/src/gfx.cpp:196: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). for (int i=strlen(base_path)-1; i>=0; i--) data/hex-a-hop-1.1.0+git20140926/src/gfx.cpp:210:6: [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 (strlen(base_path)>0) data/hex-a-hop-1.1.0+git20140926/src/gfx.cpp:212:25: [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 last = base_path[strlen(base_path)-1]; data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:254: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(filename); data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:262:3: [1] (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). Risk is low because the source is a constant character. strcat(filename, "."); data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:1511:4: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). fgetc(f); // Remove '\n' character data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:1633:7: [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 (strlen(currentSlot) == 0) data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:2012:22: [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). int16_t len = strlen(special[i][j]); data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:2115:34: [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). special[p.x][p.y] = new char [strlen(d) + 1]; data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:3968:15: [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 (win && strlen(currentFile)>0 && !isMap) data/hex-a-hop-1.1.0+git20140926/src/hex_puzzzle.cpp:4016:21: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((dir = fgetc(f)) != -1) data/hex-a-hop-1.1.0+git20140926/src/menus.h:201:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(title, m, x-m); data/hex-a-hop-1.1.0+git20140926/src/packfile.h:65:17: [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). return len - strlen(name) - 1; data/hex-a-hop-1.1.0+git20140926/src/savestate.h:158: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). name = new char[strlen(n)+1]; data/hex-a-hop-1.1.0+git20140926/src/savestate.h:243:19: [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). int16_t len = strlen(x->name); data/hex-a-hop-1.1.0+git20140926/src/savestate.h:261:12: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int v = fgetc(f); data/hex-a-hop-1.1.0+git20140926/src/state.h:71: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). reserve(strlen(a)); data/hex-a-hop-1.1.0+git20140926/src/state.h:72:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(data, a, len); data/hex-a-hop-1.1.0+git20140926/src/state.h:75: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). void operator += (const char * a) { reserve(strlen(a)+len); strcat(data, a); } data/hex-a-hop-1.1.0+git20140926/src/system-directory.c:393:9: [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). len0 = strlen (a); data/hex-a-hop-1.1.0+git20140926/src/system-directory.c:394:9: [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). len1 = strlen (b); data/hex-a-hop-1.1.0+git20140926/src/system-relative.c:76:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant string. strncpy (tmp, "/proc/self/exe", buf_size - 1); data/hex-a-hop-1.1.0+git20140926/src/system-relative.c:97:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (path, tmp, buf_size - 1); data/hex-a-hop-1.1.0+git20140926/src/system-relative.c:126: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). buf_size = strlen (path); data/hex-a-hop-1.1.0+git20140926/src/text.cpp:344: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). for (unsigned int i=0; i<strlen(tmp); ++i) data/hex-a-hop-1.1.0+git20140926/src/text.cpp:439: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). for (unsigned int i=0; i<strlen(tmp); ++i) ANALYSIS SUMMARY: Hits = 123 Lines analyzed = 8864 in approximately 0.27 seconds (32489 lines/second) Physical Source Lines of Code (SLOC) = 6870 Hits@level = [0] 25 [1] 31 [2] 60 [3] 6 [4] 24 [5] 2 Hits@level+ = [0+] 148 [1+] 123 [2+] 92 [3+] 32 [4+] 26 [5+] 2 Hits/KSLOC@level+ = [0+] 21.5429 [1+] 17.9039 [2+] 13.3916 [3+] 4.65793 [4+] 3.78457 [5+] 0.291121 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.