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/admesh-0.98.4/src/admesh.c Examining data/admesh-0.98.4/src/connect.c Examining data/admesh-0.98.4/src/normals.c Examining data/admesh-0.98.4/src/portable_endian.h Examining data/admesh-0.98.4/src/shared.c Examining data/admesh-0.98.4/src/stl.h Examining data/admesh-0.98.4/src/stl_io.c Examining data/admesh-0.98.4/src/stlinit.c Examining data/admesh-0.98.4/src/util.c FINAL RESULTS: data/admesh-0.98.4/src/shared.c:156:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(error_msg, "stl_write_ascii: Couldn't open %s for writing", data/admesh-0.98.4/src/shared.c:192:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(error_msg, "stl_write_ascii: Couldn't open %s for writing", data/admesh-0.98.4/src/shared.c:247:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(error_msg, "stl_write_ascii: Couldn't open %s for writing", file); data/admesh-0.98.4/src/stl_io.c:139:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(error_msg, "stl_write_ascii: Couldn't open %s for writing", data/admesh-0.98.4/src/stl_io.c:185:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(error_msg, "stl_print_neighbors: Couldn't open %s for writing", data/admesh-0.98.4/src/stl_io.c:276:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(error_msg, "stl_write_binary: Couldn't open %s for writing", data/admesh-0.98.4/src/stl_io.c:358:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(error_msg, "stl_write_quad_object: Couldn't open %s for writing", data/admesh-0.98.4/src/stl_io.c:426:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(error_msg, "stl_write_ascii: Couldn't open %s for writing", data/admesh-0.98.4/src/stlinit.c:88:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(error_msg, "stl_initialize: Couldn't open %s for reading", data/admesh-0.98.4/src/admesh.c:123:14: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while((c = getopt_long(argc, argv, "et:i:m:nufdcvb:a:", data/admesh-0.98.4/src/admesh.c:141: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). iterations = atoi(optarg); data/admesh-0.98.4/src/connect.c:131: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(&edge->key[0], a, sizeof(stl_vertex)); data/admesh-0.98.4/src/connect.c:132: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(&edge->key[3], b, sizeof(stl_vertex)); data/admesh-0.98.4/src/connect.c:134: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(&edge->key[0], b, sizeof(stl_vertex)); data/admesh-0.98.4/src/connect.c:135: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(&edge->key[3], a, sizeof(stl_vertex)); data/admesh-0.98.4/src/connect.c:140: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(&edge->key[0], a, sizeof(stl_vertex)); data/admesh-0.98.4/src/connect.c:141: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(&edge->key[3], b, sizeof(stl_vertex)); data/admesh-0.98.4/src/connect.c:143: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(&edge->key[0], b, sizeof(stl_vertex)); data/admesh-0.98.4/src/connect.c:144: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(&edge->key[3], a, sizeof(stl_vertex)); data/admesh-0.98.4/src/connect.c:149: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(&edge->key[0], a, sizeof(stl_vertex)); data/admesh-0.98.4/src/connect.c:150: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(&edge->key[3], b, sizeof(stl_vertex)); data/admesh-0.98.4/src/connect.c:152: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(&edge->key[0], b, sizeof(stl_vertex)); data/admesh-0.98.4/src/connect.c:153: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(&edge->key[3], a, sizeof(stl_vertex)); data/admesh-0.98.4/src/connect.c:342: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(&edge->key[0], vertex1, sizeof(stl_vertex)); data/admesh-0.98.4/src/connect.c:343: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(&edge->key[3], vertex2, sizeof(stl_vertex)); data/admesh-0.98.4/src/connect.c:345: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(&edge->key[0], vertex2, sizeof(stl_vertex)); data/admesh-0.98.4/src/connect.c:346: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(&edge->key[3], vertex1, sizeof(stl_vertex)); data/admesh-0.98.4/src/connect.c:351: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(&edge->key[0], vertex1, sizeof(stl_vertex)); data/admesh-0.98.4/src/connect.c:352: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(&edge->key[3], vertex2, sizeof(stl_vertex)); data/admesh-0.98.4/src/connect.c:354: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(&edge->key[0], vertex2, sizeof(stl_vertex)); data/admesh-0.98.4/src/connect.c:355: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(&edge->key[3], vertex1, sizeof(stl_vertex)); data/admesh-0.98.4/src/connect.c:360: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(&edge->key[0], vertex1, sizeof(stl_vertex)); data/admesh-0.98.4/src/connect.c:361: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(&edge->key[3], vertex2, sizeof(stl_vertex)); data/admesh-0.98.4/src/connect.c:363: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(&edge->key[0], vertex2, sizeof(stl_vertex)); data/admesh-0.98.4/src/connect.c:364: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(&edge->key[3], vertex1, sizeof(stl_vertex)); data/admesh-0.98.4/src/shared.c:152:8: [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). fp = fopen(file, "w"); data/admesh-0.98.4/src/shared.c:188:8: [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). fp = fopen(file, "w"); data/admesh-0.98.4/src/shared.c:244:8: [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). fp = fopen(file, "w"); data/admesh-0.98.4/src/stl.h:55: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. typedef char stl_extra[2]; data/admesh-0.98.4/src/stl.h:81: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 which_vertex_not[3]; data/admesh-0.98.4/src/stl.h:89: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 header[81]; data/admesh-0.98.4/src/stl_io.c:135:8: [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). fp = fopen(file, "w"); data/admesh-0.98.4/src/stl_io.c:181:8: [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). fp = fopen(file, "w"); data/admesh-0.98.4/src/stl_io.c:211: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 char_value[4]; data/admesh-0.98.4/src/stl_io.c:228: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 char_value[4]; data/admesh-0.98.4/src/stl_io.c:272:8: [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). fp = fopen(file, "wb"); data/admesh-0.98.4/src/stl_io.c:354:8: [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). fp = fopen(file, "w"); data/admesh-0.98.4/src/stl_io.c:422:8: [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). fp = fopen(file, "w"); data/admesh-0.98.4/src/stlinit.c:77:12: [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 chtest[128]; data/admesh-0.98.4/src/stlinit.c:84:13: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). stl->fp = fopen(file, "rb"); data/admesh-0.98.4/src/stlinit.c:260: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 facet_buffer[12 * sizeof(float)]; data/admesh-0.98.4/src/stlinit.c:302: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(&endianswap_buffer, facet_buffer + j * sizeof(float), 4); data/admesh-0.98.4/src/stlinit.c:304: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(facet_floats[j], &endianswap_buffer, 4); data/admesh-0.98.4/src/shared.c:155:29: [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). malloc(81 + strlen(file)); /* Allow 80 chars+file size for message */ data/admesh-0.98.4/src/shared.c:191:29: [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). malloc(81 + strlen(file)); /* Allow 80 chars+file size for message */ data/admesh-0.98.4/src/shared.c:246:42: [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* error_msg = (char*)malloc(81 + strlen(file)); /* Allow 80 chars+file size for message */ data/admesh-0.98.4/src/stl_io.c:138:29: [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). malloc(81 + strlen(file)); /* Allow 80 chars+file size for message */ data/admesh-0.98.4/src/stl_io.c:184:29: [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). malloc(81 + strlen(file)); /* Allow 80 chars+file size for message */ data/admesh-0.98.4/src/stl_io.c:275:29: [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). malloc(81 + strlen(file)); /* Allow 80 chars+file size for message */ data/admesh-0.98.4/src/stl_io.c:285: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). for(i = strlen(label); i < LABEL_SIZE; i++) putc(0, fp); data/admesh-0.98.4/src/stl_io.c:357:29: [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). malloc(81 + strlen(file)); /* Allow 80 chars+file size for message */ data/admesh-0.98.4/src/stl_io.c:425:29: [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). malloc(81 + strlen(file)); /* Allow 80 chars+file size for message */ data/admesh-0.98.4/src/stlinit.c:87:29: [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). malloc(81 + strlen(file)); /* Allow 80 chars+file size for message */ data/admesh-0.98.4/src/stlinit.c:151:10: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if(getc(stl->fp) == '\n') { data/admesh-0.98.4/src/stlinit.c:162:45: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). (i < 80) && (stl->stats.header[i] = getc(stl->fp)) != '\n'; i++); data/admesh-0.98.4/src/stlinit.c:286:11: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while(getc(stl->fp) != '\n'); ANALYSIS SUMMARY: Hits = 66 Lines analyzed = 3759 in approximately 0.14 seconds (26309 lines/second) Physical Source Lines of Code (SLOC) = 2941 Hits@level = [0] 179 [1] 13 [2] 43 [3] 1 [4] 9 [5] 0 Hits@level+ = [0+] 245 [1+] 66 [2+] 53 [3+] 10 [4+] 9 [5+] 0 Hits/KSLOC@level+ = [0+] 83.305 [1+] 22.4413 [2+] 18.0211 [3+] 3.4002 [4+] 3.06018 [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.