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/einstein-2.0.dfsg.2/streams.h Examining data/einstein-2.0.dfsg.2/descr.h Examining data/einstein-2.0.dfsg.2/random.cpp Examining data/einstein-2.0.dfsg.2/horhints.cpp Examining data/einstein-2.0.dfsg.2/messages.h Examining data/einstein-2.0.dfsg.2/tablestorage.h Examining data/einstein-2.0.dfsg.2/unicode.h Examining data/einstein-2.0.dfsg.2/rules.cpp Examining data/einstein-2.0.dfsg.2/lexal.h Examining data/einstein-2.0.dfsg.2/font.cpp Examining data/einstein-2.0.dfsg.2/widgets.cpp Examining data/einstein-2.0.dfsg.2/resources.h Examining data/einstein-2.0.dfsg.2/storage.cpp Examining data/einstein-2.0.dfsg.2/regstorage.cpp Examining data/einstein-2.0.dfsg.2/i18n.cpp Examining data/einstein-2.0.dfsg.2/visitor.h Examining data/einstein-2.0.dfsg.2/table.h Examining data/einstein-2.0.dfsg.2/streams.cpp Examining data/einstein-2.0.dfsg.2/tablestorage.cpp Examining data/einstein-2.0.dfsg.2/puzgen.h Examining data/einstein-2.0.dfsg.2/topscores.h Examining data/einstein-2.0.dfsg.2/puzzle.h Examining data/einstein-2.0.dfsg.2/formatter.h Examining data/einstein-2.0.dfsg.2/puzzle.cpp Examining data/einstein-2.0.dfsg.2/horhints.h Examining data/einstein-2.0.dfsg.2/i18n.h Examining data/einstein-2.0.dfsg.2/conf.h Examining data/einstein-2.0.dfsg.2/conf.cpp Examining data/einstein-2.0.dfsg.2/game.h Examining data/einstein-2.0.dfsg.2/random.h Examining data/einstein-2.0.dfsg.2/tokenizer.h Examining data/einstein-2.0.dfsg.2/resources.cpp Examining data/einstein-2.0.dfsg.2/main.h Examining data/einstein-2.0.dfsg.2/regstorage.h Examining data/einstein-2.0.dfsg.2/buffer.h Examining data/einstein-2.0.dfsg.2/options.h Examining data/einstein-2.0.dfsg.2/tokenizer.cpp Examining data/einstein-2.0.dfsg.2/exceptions.h Examining data/einstein-2.0.dfsg.2/verthints.h Examining data/einstein-2.0.dfsg.2/lexal.cpp Examining data/einstein-2.0.dfsg.2/storage.h Examining data/einstein-2.0.dfsg.2/buffer.cpp Examining data/einstein-2.0.dfsg.2/iconset.cpp Examining data/einstein-2.0.dfsg.2/convert.cpp Examining data/einstein-2.0.dfsg.2/messages.cpp Examining data/einstein-2.0.dfsg.2/table.cpp Examining data/einstein-2.0.dfsg.2/verthints.cpp Examining data/einstein-2.0.dfsg.2/utils.cpp Examining data/einstein-2.0.dfsg.2/opensave.h Examining data/einstein-2.0.dfsg.2/mkres/compressor.h Examining data/einstein-2.0.dfsg.2/mkres/streams.h Examining data/einstein-2.0.dfsg.2/mkres/messages.h Examining data/einstein-2.0.dfsg.2/mkres/msgformatter.cpp Examining data/einstein-2.0.dfsg.2/mkres/unicode.h Examining data/einstein-2.0.dfsg.2/mkres/lexal.h Examining data/einstein-2.0.dfsg.2/mkres/table.h Examining data/einstein-2.0.dfsg.2/mkres/format.h Examining data/einstein-2.0.dfsg.2/mkres/streams.cpp Examining data/einstein-2.0.dfsg.2/mkres/msgformatter.h Examining data/einstein-2.0.dfsg.2/mkres/format.cpp Examining data/einstein-2.0.dfsg.2/mkres/buffer.h Examining data/einstein-2.0.dfsg.2/mkres/exceptions.h Examining data/einstein-2.0.dfsg.2/mkres/lexal.cpp Examining data/einstein-2.0.dfsg.2/mkres/buffer.cpp Examining data/einstein-2.0.dfsg.2/mkres/convert.cpp Examining data/einstein-2.0.dfsg.2/mkres/messages.cpp Examining data/einstein-2.0.dfsg.2/mkres/table.cpp Examining data/einstein-2.0.dfsg.2/mkres/convert.h Examining data/einstein-2.0.dfsg.2/mkres/compressor.cpp Examining data/einstein-2.0.dfsg.2/mkres/main.cpp Examining data/einstein-2.0.dfsg.2/mkres/unicode.cpp Examining data/einstein-2.0.dfsg.2/font.h Examining data/einstein-2.0.dfsg.2/iconset.h Examining data/einstein-2.0.dfsg.2/screen.cpp Examining data/einstein-2.0.dfsg.2/screen.h Examining data/einstein-2.0.dfsg.2/sound.cpp Examining data/einstein-2.0.dfsg.2/sound.h Examining data/einstein-2.0.dfsg.2/utils.h Examining data/einstein-2.0.dfsg.2/widgets.h Examining data/einstein-2.0.dfsg.2/game.cpp Examining data/einstein-2.0.dfsg.2/menu.cpp Examining data/einstein-2.0.dfsg.2/opensave.cpp Examining data/einstein-2.0.dfsg.2/options.cpp Examining data/einstein-2.0.dfsg.2/topscores.cpp Examining data/einstein-2.0.dfsg.2/main.cpp Examining data/einstein-2.0.dfsg.2/puzgen.cpp Examining data/einstein-2.0.dfsg.2/formatter.cpp Examining data/einstein-2.0.dfsg.2/convert.h Examining data/einstein-2.0.dfsg.2/descr.cpp Examining data/einstein-2.0.dfsg.2/unicode.cpp FINAL RESULTS: data/einstein-2.0.dfsg.2/conf.cpp:1006:9: [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(buf, s); \ data/einstein-2.0.dfsg.2/convert.cpp:31:5: [4] (format) swprintf: Potential format string problem (CWE-134). Make format string constant. swprintf(buf, 29, L"%i", num); data/einstein-2.0.dfsg.2/convert.cpp:43:5: [4] (format) swprintf: Potential format string problem (CWE-134). Make format string constant. swprintf(buf, 29, L"%i", num); data/einstein-2.0.dfsg.2/mkres/convert.cpp:31:5: [4] (format) swprintf: Potential format string problem (CWE-134). Make format string constant. swprintf(buf, 29, L"%i", num); data/einstein-2.0.dfsg.2/mkres/convert.cpp:43:5: [4] (format) swprintf: Potential format string problem (CWE-134). Make format string constant. swprintf(buf, 29, L"%i", num); data/einstein-2.0.dfsg.2/utils.cpp:278:5: [4] (format) swprintf: Potential format string problem (CWE-134). Make format string constant. swprintf(buf, 50, L"%02i:%02i:%02i", hours, minutes, seconds); data/einstein-2.0.dfsg.2/main.cpp:74:29: [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. dirs.push_back(fromMbcs(getenv("HOME")) + L"/.einstein/res"); data/einstein-2.0.dfsg.2/main.cpp:100:30: [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. ensureDirExists(fromMbcs(getenv("HOME")) + std::wstring(L"/.einstein")); data/einstein-2.0.dfsg.2/opensave.cpp:143:32: [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. std::wstring path(fromMbcs(getenv("HOME")) + data/einstein-2.0.dfsg.2/puzgen.cpp:316: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(time(NULL)); data/einstein-2.0.dfsg.2/tablestorage.cpp:28:34: [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. return std::wstring(fromMbcs(getenv("HOME"))) + L"/.einstein/einsteinrc"; data/einstein-2.0.dfsg.2/buffer.cpp:65:5: [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((unsigned char*)data + currentPos, d, length); data/einstein-2.0.dfsg.2/buffer.cpp:73:14: [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 b[4]; data/einstein-2.0.dfsg.2/conf.cpp:405: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). f = fopen(filename, "rb"); data/einstein-2.0.dfsg.2/conf.cpp:620:40: [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). table_set_int(table, name, atoi(value)); data/einstein-2.0.dfsg.2/conf.cpp:652: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 b[100]; data/einstein-2.0.dfsg.2/conf.cpp:653:5: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(b, "%i", idx); data/einstein-2.0.dfsg.2/conf.cpp:955:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[100]; data/einstein-2.0.dfsg.2/conf.cpp:964: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(buf, "%i", field->value.int_value); data/einstein-2.0.dfsg.2/conf.cpp:967: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(buf, "%g", field->value.double_value); data/einstein-2.0.dfsg.2/conf.cpp:969:17: [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(buf, ".0"); data/einstein-2.0.dfsg.2/conf.cpp:982:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[50]; data/einstein-2.0.dfsg.2/conf.cpp:987: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, "%i", i); data/einstein-2.0.dfsg.2/conf.cpp:1027:13: [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(b, "{\n"); data/einstein-2.0.dfsg.2/conf.cpp:1029:13: [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(b, "{ "); data/einstein-2.0.dfsg.2/conf.cpp:1068:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[100]; data/einstein-2.0.dfsg.2/conf.cpp:1083: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(buf, "%i", field->value.int_value); data/einstein-2.0.dfsg.2/conf.cpp:1086: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(buf, "%f", field->value.double_value); data/einstein-2.0.dfsg.2/conf.cpp:1394: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 b[100]; data/einstein-2.0.dfsg.2/conf.cpp:1400:5: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(b, "%i", idx); data/einstein-2.0.dfsg.2/conf.cpp:1409: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 b[100]; data/einstein-2.0.dfsg.2/conf.cpp:1415:5: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(b, "%i", idx); data/einstein-2.0.dfsg.2/conf.cpp:1424: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 b[100]; data/einstein-2.0.dfsg.2/conf.cpp:1430:5: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(b, "%i", idx); data/einstein-2.0.dfsg.2/conf.cpp:1439: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 b[100]; data/einstein-2.0.dfsg.2/conf.cpp:1445:5: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(b, "%i", idx); data/einstein-2.0.dfsg.2/convert.cpp:27:5: [2] (buffer) wchar_t: 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. wchar_t buf[30]; data/einstein-2.0.dfsg.2/convert.cpp:29:5: [2] (buffer) swprintf: 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. swprintf(buf, L"%i", num); data/einstein-2.0.dfsg.2/convert.cpp:39:5: [2] (buffer) wchar_t: 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. wchar_t buf[30]; data/einstein-2.0.dfsg.2/convert.cpp:41:5: [2] (buffer) swprintf: 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. swprintf(buf, L"%u", num); data/einstein-2.0.dfsg.2/game.cpp:436:5: [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(savedSolvedPuzzle, solvedPuzzle, sizeof(solvedPuzzle)); data/einstein-2.0.dfsg.2/game.cpp:498:5: [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(savedSolvedPuzzle, solvedPuzzle, sizeof(solvedPuzzle)); data/einstein-2.0.dfsg.2/i18n.cpp:18:3: [2] (buffer) wchar_t: 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. wchar_t iso2[3]; data/einstein-2.0.dfsg.2/i18n.cpp:19: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 iso3[4]; data/einstein-2.0.dfsg.2/i18n.cpp:289:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[100]; data/einstein-2.0.dfsg.2/mkres/buffer.cpp:65:5: [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((unsigned char*)data + currentPos, d, length); data/einstein-2.0.dfsg.2/mkres/buffer.cpp:73:14: [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 b[4]; data/einstein-2.0.dfsg.2/mkres/compressor.cpp:30:14: [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 b[4]; data/einstein-2.0.dfsg.2/mkres/compressor.cpp:77:12: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). s->open(outputFile.c_str(), std::ios::out | std::ios::binary); data/einstein-2.0.dfsg.2/mkres/compressor.cpp:156:13: [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(out, in, inSize); data/einstein-2.0.dfsg.2/mkres/convert.cpp:27:5: [2] (buffer) wchar_t: 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. wchar_t buf[30]; data/einstein-2.0.dfsg.2/mkres/convert.cpp:29:5: [2] (buffer) swprintf: 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. swprintf(buf, L"%i", num); data/einstein-2.0.dfsg.2/mkres/convert.cpp:39:5: [2] (buffer) wchar_t: 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. wchar_t buf[30]; data/einstein-2.0.dfsg.2/mkres/convert.cpp:41:5: [2] (buffer) swprintf: 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. swprintf(buf, L"%u", num); data/einstein-2.0.dfsg.2/mkres/streams.cpp:18:14: [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 buf[10]; data/einstein-2.0.dfsg.2/mkres/unicode.cpp:57:14: [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 const char utf8_skip_data[256] = { data/einstein-2.0.dfsg.2/mkres/unicode.cpp:137:20: [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. if ((((unsigned char *)p)[i] & 0xc0) != 0x80) data/einstein-2.0.dfsg.2/mkres/unicode.cpp:145:31: [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. wchar_t ch = ((unsigned char *)p)[i]; data/einstein-2.0.dfsg.2/mkres/unicode.cpp:462:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[bufSize]; data/einstein-2.0.dfsg.2/mkres/unicode.cpp:477:5: [2] (buffer) wchar_t: 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. wchar_t buf[len + 1]; data/einstein-2.0.dfsg.2/mkres/unicode.cpp:479:15: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). int res = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), len + 1, data/einstein-2.0.dfsg.2/mkres/unicode.cpp:494:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[bufSize]; data/einstein-2.0.dfsg.2/mkres/unicode.cpp:509:5: [2] (buffer) wchar_t: 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. wchar_t buf[len + 1]; data/einstein-2.0.dfsg.2/mkres/unicode.cpp:511:15: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). int res = MultiByteToWideChar(CP_OEMCP, 0, str.c_str(), len + 1, data/einstein-2.0.dfsg.2/mkres/unicode.cpp:526:5: [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(buf, str, len); data/einstein-2.0.dfsg.2/mkres/unicode.cpp:541: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[maxSize + 1]; data/einstein-2.0.dfsg.2/mkres/unicode.cpp:564:5: [2] (buffer) wchar_t: 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. wchar_t ws[maxLen + 1]; data/einstein-2.0.dfsg.2/resources.cpp:121:5: [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(buffer, data, sz); data/einstein-2.0.dfsg.2/resources.cpp:144:12: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). stream.open(toMbcs(fileName).c_str(), std::ios::in | std::ios::binary); data/einstein-2.0.dfsg.2/resources.cpp:148: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 sign[4]; data/einstein-2.0.dfsg.2/resources.cpp:349:9: [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, &self, sizeof(self)); data/einstein-2.0.dfsg.2/resources.cpp:383:9: [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, data, unpackedSize); data/einstein-2.0.dfsg.2/resources.cpp:395:9: [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((char*)buffer.getData(), data, unpackedSize); data/einstein-2.0.dfsg.2/streams.cpp:18:14: [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 buf[10]; data/einstein-2.0.dfsg.2/unicode.cpp:57:14: [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 const char utf8_skip_data[256] = { data/einstein-2.0.dfsg.2/unicode.cpp:137:20: [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. if ((((unsigned char *)p)[i] & 0xc0) != 0x80) data/einstein-2.0.dfsg.2/unicode.cpp:145:31: [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. wchar_t ch = ((unsigned char *)p)[i]; data/einstein-2.0.dfsg.2/unicode.cpp:462:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[bufSize]; data/einstein-2.0.dfsg.2/unicode.cpp:477:5: [2] (buffer) wchar_t: 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. wchar_t buf[len + 1]; data/einstein-2.0.dfsg.2/unicode.cpp:479:15: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). int res = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), len + 1, data/einstein-2.0.dfsg.2/unicode.cpp:494:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[bufSize]; data/einstein-2.0.dfsg.2/unicode.cpp:509:5: [2] (buffer) wchar_t: 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. wchar_t buf[len + 1]; data/einstein-2.0.dfsg.2/unicode.cpp:511:15: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). int res = MultiByteToWideChar(CP_OEMCP, 0, str.c_str(), len + 1, data/einstein-2.0.dfsg.2/unicode.cpp:526:5: [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(buf, str, len); data/einstein-2.0.dfsg.2/unicode.cpp:541: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[maxSize + 1]; data/einstein-2.0.dfsg.2/unicode.cpp:564:5: [2] (buffer) wchar_t: 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. wchar_t ws[maxLen + 1]; data/einstein-2.0.dfsg.2/utils.cpp:274:5: [2] (buffer) wchar_t: 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. wchar_t buf[50]; data/einstein-2.0.dfsg.2/utils.cpp:276:5: [2] (buffer) swprintf: 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. swprintf(buf, L"%02i:%02i:%02i", hours, minutes, seconds); data/einstein-2.0.dfsg.2/utils.cpp:365:14: [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 buf[4]; data/einstein-2.0.dfsg.2/utils.cpp:396:14: [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 b[4]; data/einstein-2.0.dfsg.2/widgets.cpp:682:9: [2] (buffer) wchar_t: 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. wchar_t buf[2]; data/einstein-2.0.dfsg.2/conf.cpp:462: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). if (strlen(str) < 1) data/einstein-2.0.dfsg.2/conf.cpp:481: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). if ((len = strlen(value)) >= 2) data/einstein-2.0.dfsg.2/conf.cpp:995:38: [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). #define APPEND_BUF(buf, s) { int l = strlen(s); \ data/einstein-2.0.dfsg.2/conf.cpp:1031:9: [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(b, ""); data/einstein-2.0.dfsg.2/conf.cpp:1032: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). len = strlen(b); data/einstein-2.0.dfsg.2/font.cpp:17:22: [1] (buffer) wcslen: 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 len = wcslen(str); data/einstein-2.0.dfsg.2/mkres/compressor.cpp:192:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ifs.read((char*)unpackedBuffer.getData(), realSize); data/einstein-2.0.dfsg.2/mkres/table.cpp:193:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read) { data/einstein-2.0.dfsg.2/resources.cpp:39:22: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). virtual void read(char *buffer, size_t size); data/einstein-2.0.dfsg.2/resources.cpp:58:30: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). void UnpackedResourceStream::read(char *buffer, size_t sz) data/einstein-2.0.dfsg.2/resources.cpp:65:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). stream.read(buffer, sz); data/einstein-2.0.dfsg.2/resources.cpp:92:22: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). virtual void read(char *buffer, size_t size); data/einstein-2.0.dfsg.2/resources.cpp:115:28: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). void MemoryResourceStream::read(char *buffer, size_t sz) data/einstein-2.0.dfsg.2/resources.cpp:149:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). stream.read(sign, 4); data/einstein-2.0.dfsg.2/resources.cpp:231:20: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). stream.read(buf, unpackedSize); data/einstein-2.0.dfsg.2/resources.cpp:237:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). stream.read((char*)buffer->getData(), packedSize); data/einstein-2.0.dfsg.2/resources.h:39:22: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). virtual void read(char *buffer, size_t size) = 0; data/einstein-2.0.dfsg.2/table.cpp:193:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read) { data/einstein-2.0.dfsg.2/utils.cpp:366:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). stream.read((char*)buf, 4); ANALYSIS SUMMARY: Hits = 110 Lines analyzed = 15189 in approximately 0.35 seconds (43316 lines/second) Physical Source Lines of Code (SLOC) = 11627 Hits@level = [0] 2 [1] 19 [2] 80 [3] 5 [4] 6 [5] 0 Hits@level+ = [0+] 112 [1+] 110 [2+] 91 [3+] 11 [4+] 6 [5+] 0 Hits/KSLOC@level+ = [0+] 9.63275 [1+] 9.46074 [2+] 7.82661 [3+] 0.946074 [4+] 0.51604 [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.