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/tinyobjloader-2.0.0~rc5+dfsg1/examples/callback_api/main.cc Examining data/tinyobjloader-2.0.0~rc5+dfsg1/examples/obj_sticher/obj_sticher.cc Examining data/tinyobjloader-2.0.0~rc5+dfsg1/examples/obj_sticher/obj_writer.cc Examining data/tinyobjloader-2.0.0~rc5+dfsg1/examples/obj_sticher/obj_writer.h Examining data/tinyobjloader-2.0.0~rc5+dfsg1/examples/voxelize/voxelizer.h Examining data/tinyobjloader-2.0.0~rc5+dfsg1/examples/voxelize/main.cc Examining data/tinyobjloader-2.0.0~rc5+dfsg1/loader_example.cc Examining data/tinyobjloader-2.0.0~rc5+dfsg1/python/bindings.cc Examining data/tinyobjloader-2.0.0~rc5+dfsg1/python/tiny_obj_loader.cc Examining data/tinyobjloader-2.0.0~rc5+dfsg1/tests/acutest.h Examining data/tinyobjloader-2.0.0~rc5+dfsg1/tests/tester.cc Examining data/tinyobjloader-2.0.0~rc5+dfsg1/tiny_obj_loader.cc Examining data/tinyobjloader-2.0.0~rc5+dfsg1/tiny_obj_loader.h FINAL RESULTS: data/tinyobjloader-2.0.0~rc5+dfsg1/tests/acutest.h:394:5: [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(buffer, sizeof(buffer), fmt, args); data/tinyobjloader-2.0.0~rc5+dfsg1/tests/acutest.h:568:9: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vprintf(fmt, args); data/tinyobjloader-2.0.0~rc5+dfsg1/tests/acutest.h:598:5: [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(test_case_name__, sizeof(test_case_name__) - 1, fmt, args); data/tinyobjloader-2.0.0~rc5+dfsg1/tests/acutest.h:627:5: [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(buffer, TEST_MSG_MAXSIZE, fmt, args); data/tinyobjloader-2.0.0~rc5+dfsg1/tests/acutest.h:667:5: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf((title[strlen(title)-1] == ':') ? "%s\n" : "%s:\n", title); data/tinyobjloader-2.0.0~rc5+dfsg1/tests/acutest.h:812:9: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vprintf(fmt, args); data/tinyobjloader-2.0.0~rc5+dfsg1/tests/acutest.h:1104:33: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(auxbuf, "--%s", opt->longname); data/tinyobjloader-2.0.0~rc5+dfsg1/tiny_obj_loader.h:731:29: [3] (random) setstate: 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. if (t.empty()) is.setstate(std::ios::eofbit); data/tinyobjloader-2.0.0~rc5+dfsg1/examples/obj_sticher/obj_sticher.cc:70: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. char buf[1024]; data/tinyobjloader-2.0.0~rc5+dfsg1/examples/obj_sticher/obj_sticher.cc:71:7: [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, "_%04d", (int)i); data/tinyobjloader-2.0.0~rc5+dfsg1/examples/obj_sticher/obj_writer.cc:15: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* fp = fopen(filename.c_str(), "w"); data/tinyobjloader-2.0.0~rc5+dfsg1/examples/obj_sticher/obj_writer.cc:44: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* fp = fopen(filename.c_str(), "w"); data/tinyobjloader-2.0.0~rc5+dfsg1/examples/voxelize/voxelizer.h:723: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(outmesh->normals, vx_normals, 18 * sizeof(float)); data/tinyobjloader-2.0.0~rc5+dfsg1/python/bindings.cc:44: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(buf.ptr, instance.vertices.data(), instance.vertices.size() * sizeof(real_t)); data/tinyobjloader-2.0.0~rc5+dfsg1/python/bindings.cc:128: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(buf.ptr, instance.num_face_vertices.data(), instance.num_face_vertices.size() * sizeof(unsigned char)); data/tinyobjloader-2.0.0~rc5+dfsg1/python/bindings.cc:145: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(buf.ptr, instance.indices.data(), instance.indices.size() * 3 * sizeof(int)); data/tinyobjloader-2.0.0~rc5+dfsg1/tests/acutest.h:293: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 test_case_name__[64] = ""; data/tinyobjloader-2.0.0~rc5+dfsg1/tests/acutest.h:390: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 buffer[256]; data/tinyobjloader-2.0.0~rc5+dfsg1/tests/acutest.h:456:13: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char spaces[48]; data/tinyobjloader-2.0.0~rc5+dfsg1/tests/acutest.h:613: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 buffer[TEST_MSG_MAXSIZE]; data/tinyobjloader-2.0.0~rc5+dfsg1/tests/acutest.h:931:17: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char tmp[32]; data/tinyobjloader-2.0.0~rc5+dfsg1/tests/acutest.h:942:35: [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. default: sprintf(tmp, "signal %d", WTERMSIG(exit_code)); signame = tmp; break; data/tinyobjloader-2.0.0~rc5+dfsg1/tests/acutest.h:952: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 buffer[512] = {0}; data/tinyobjloader-2.0.0~rc5+dfsg1/tests/acutest.h:1046:13: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char badoptname[3]; data/tinyobjloader-2.0.0~rc5+dfsg1/tests/acutest.h:1069: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 auxbuf[TEST_CMDLINE_AUXBUF_SIZE__+1]; data/tinyobjloader-2.0.0~rc5+dfsg1/tests/acutest.h:1287:51: [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). test_verbose_level__ = (arg != NULL ? atoi(arg) : test_verbose_level__+1); data/tinyobjloader-2.0.0~rc5+dfsg1/tests/acutest.h:1314:35: [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). test_worker_index__ = atoi(arg); data/tinyobjloader-2.0.0~rc5+dfsg1/tests/acutest.h:1349: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[256+32+1]; data/tinyobjloader-2.0.0~rc5+dfsg1/tests/acutest.h:1354:10: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open("/proc/self/status", O_RDONLY); data/tinyobjloader-2.0.0~rc5+dfsg1/tests/acutest.h:1366: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). pid_t tracer_pid = (pid_t) atoi(field + sizeof(pattern) - 1); data/tinyobjloader-2.0.0~rc5+dfsg1/tiny_obj_loader.h:782:11: [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 i = atoi((*token)); data/tinyobjloader-2.0.0~rc5+dfsg1/tiny_obj_loader.h:1056: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). ts.num_ints = atoi((*token)); data/tinyobjloader-2.0.0~rc5+dfsg1/tiny_obj_loader.h:1065:18: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). ts.num_reals = atoi((*token)); data/tinyobjloader-2.0.0~rc5+dfsg1/tiny_obj_loader.h:1086: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). if (!fixIndex(atoi((*token)), vsize, &(vi.v_idx))) { data/tinyobjloader-2.0.0~rc5+dfsg1/tiny_obj_loader.h:1100:19: [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). if (!fixIndex(atoi((*token)), vnsize, &(vi.vn_idx))) { data/tinyobjloader-2.0.0~rc5+dfsg1/tiny_obj_loader.h:1109: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). if (!fixIndex(atoi((*token)), vtsize, &(vi.vt_idx))) { data/tinyobjloader-2.0.0~rc5+dfsg1/tiny_obj_loader.h:1121: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). if (!fixIndex(atoi((*token)), vnsize, &(vi.vn_idx))) { data/tinyobjloader-2.0.0~rc5+dfsg1/tiny_obj_loader.h:1135:14: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). vi.v_idx = atoi((*token)); data/tinyobjloader-2.0.0~rc5+dfsg1/tiny_obj_loader.h:1145: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). vi.vn_idx = atoi((*token)); data/tinyobjloader-2.0.0~rc5+dfsg1/tiny_obj_loader.h:1151:15: [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). vi.vt_idx = atoi((*token)); data/tinyobjloader-2.0.0~rc5+dfsg1/tiny_obj_loader.h:1159:15: [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). vi.vn_idx = atoi((*token)); data/tinyobjloader-2.0.0~rc5+dfsg1/tiny_obj_loader.h:2932:28: [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). tag.intValues[i] = atoi(token); data/tinyobjloader-2.0.0~rc5+dfsg1/tests/acutest.h:667: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). printf((title[strlen(title)-1] == ':') ? "%s\n" : "%s:\n", title); data/tinyobjloader-2.0.0~rc5+dfsg1/tests/acutest.h:731: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). pattern_len = strlen(pattern); data/tinyobjloader-2.0.0~rc5+dfsg1/tests/acutest.h:1089: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). size_t len = strlen(opt->longname); data/tinyobjloader-2.0.0~rc5+dfsg1/tests/acutest.h:1151:29: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(auxbuf, badoptname, len); data/tinyobjloader-2.0.0~rc5+dfsg1/tests/acutest.h:1358:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). n_read = read(fd, buf, sizeof(buf)-1); data/tinyobjloader-2.0.0~rc5+dfsg1/tests/acutest.h:1373:22: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). n_read = read(fd, buf+32, sizeof(buf)-1-32); data/tinyobjloader-2.0.0~rc5+dfsg1/tiny_obj_loader.h:892:20: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). (read < lut_entries ? pow_lut[read] : std::pow(10.0, -read)); data/tinyobjloader-2.0.0~rc5+dfsg1/tiny_obj_loader.h:892:49: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). (read < lut_entries ? pow_lut[read] : std::pow(10.0, -read)); data/tinyobjloader-2.0.0~rc5+dfsg1/tiny_obj_loader.h:892:73: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). (read < lut_entries ? pow_lut[read] : std::pow(10.0, -read)); data/tinyobjloader-2.0.0~rc5+dfsg1/tiny_obj_loader.h:1032:43: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if ((0 == strncmp((*token), "cube_top", strlen("cube_top")))) { data/tinyobjloader-2.0.0~rc5+dfsg1/tiny_obj_loader.h:1034:53: [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). } else if ((0 == strncmp((*token), "cube_bottom", strlen("cube_bottom")))) { data/tinyobjloader-2.0.0~rc5+dfsg1/tiny_obj_loader.h:1036:51: [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). } else if ((0 == strncmp((*token), "cube_left", strlen("cube_left")))) { data/tinyobjloader-2.0.0~rc5+dfsg1/tiny_obj_loader.h:1038:52: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). } else if ((0 == strncmp((*token), "cube_right", strlen("cube_right")))) { data/tinyobjloader-2.0.0~rc5+dfsg1/tiny_obj_loader.h:1040:52: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). } else if ((0 == strncmp((*token), "cube_front", strlen("cube_front")))) { data/tinyobjloader-2.0.0~rc5+dfsg1/tiny_obj_loader.h:1042:51: [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). } else if ((0 == strncmp((*token), "cube_back", strlen("cube_back")))) { data/tinyobjloader-2.0.0~rc5+dfsg1/tiny_obj_loader.h:1044:48: [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). } else if ((0 == strncmp((*token), "sphere", strlen("sphere")))) { data/tinyobjloader-2.0.0~rc5+dfsg1/tiny_obj_loader.h:2605: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). if (strlen(token) >= 3 && token[0] == 'o' && token[1] == 'f' && ANALYSIS SUMMARY: Hits = 59 Lines analyzed = 7876 in approximately 0.22 seconds (36071 lines/second) Physical Source Lines of Code (SLOC) = 5860 Hits@level = [0] 263 [1] 17 [2] 34 [3] 1 [4] 7 [5] 0 Hits@level+ = [0+] 322 [1+] 59 [2+] 42 [3+] 8 [4+] 7 [5+] 0 Hits/KSLOC@level+ = [0+] 54.9488 [1+] 10.0683 [2+] 7.16724 [3+] 1.36519 [4+] 1.19454 [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.