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/libplist-2.2.0/cython/plist_util.c Examining data/libplist-2.2.0/cython/plist_util.h Examining data/libplist-2.2.0/fuzz/bplist_fuzzer.cc Examining data/libplist-2.2.0/fuzz/xplist_fuzzer.cc Examining data/libplist-2.2.0/include/plist/Array.h Examining data/libplist-2.2.0/include/plist/Boolean.h Examining data/libplist-2.2.0/include/plist/Data.h Examining data/libplist-2.2.0/include/plist/Date.h Examining data/libplist-2.2.0/include/plist/Dictionary.h Examining data/libplist-2.2.0/include/plist/Integer.h Examining data/libplist-2.2.0/include/plist/Key.h Examining data/libplist-2.2.0/include/plist/Node.h Examining data/libplist-2.2.0/include/plist/Real.h Examining data/libplist-2.2.0/include/plist/String.h Examining data/libplist-2.2.0/include/plist/Structure.h Examining data/libplist-2.2.0/include/plist/Uid.h Examining data/libplist-2.2.0/include/plist/plist++.h Examining data/libplist-2.2.0/include/plist/plist.h Examining data/libplist-2.2.0/libcnary/cnary.c Examining data/libplist-2.2.0/libcnary/include/node.h Examining data/libplist-2.2.0/libcnary/include/node_list.h Examining data/libplist-2.2.0/libcnary/include/object.h Examining data/libplist-2.2.0/libcnary/node.c Examining data/libplist-2.2.0/libcnary/node_list.c Examining data/libplist-2.2.0/src/Array.cpp Examining data/libplist-2.2.0/src/Boolean.cpp Examining data/libplist-2.2.0/src/Data.cpp Examining data/libplist-2.2.0/src/Date.cpp Examining data/libplist-2.2.0/src/Dictionary.cpp Examining data/libplist-2.2.0/src/Integer.cpp Examining data/libplist-2.2.0/src/Key.cpp Examining data/libplist-2.2.0/src/Node.cpp Examining data/libplist-2.2.0/src/Real.cpp Examining data/libplist-2.2.0/src/String.cpp Examining data/libplist-2.2.0/src/Structure.cpp Examining data/libplist-2.2.0/src/Uid.cpp Examining data/libplist-2.2.0/src/base64.c Examining data/libplist-2.2.0/src/base64.h Examining data/libplist-2.2.0/src/bplist.c Examining data/libplist-2.2.0/src/bytearray.c Examining data/libplist-2.2.0/src/bytearray.h Examining data/libplist-2.2.0/src/hashtable.c Examining data/libplist-2.2.0/src/hashtable.h Examining data/libplist-2.2.0/src/plist.c Examining data/libplist-2.2.0/src/plist.h Examining data/libplist-2.2.0/src/ptrarray.c Examining data/libplist-2.2.0/src/ptrarray.h Examining data/libplist-2.2.0/src/strbuf.h Examining data/libplist-2.2.0/src/time64.c Examining data/libplist-2.2.0/src/time64.h Examining data/libplist-2.2.0/src/time64_limits.h Examining data/libplist-2.2.0/src/xplist.c Examining data/libplist-2.2.0/test/plist_cmp.c Examining data/libplist-2.2.0/test/plist_test.c Examining data/libplist-2.2.0/tools/plistutil.c FINAL RESULTS: data/libplist-2.2.0/src/bplist.c:209:51: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define PLIST_BIN_ERR(...) if (plist_bin_debug) { fprintf(stderr, "libplist[binparser] ERROR: " __VA_ARGS__); } data/libplist-2.2.0/src/time64.c:151:35: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. # define TIME64_TRACE(format) (fprintf(stderr, format)) data/libplist-2.2.0/src/time64.c:152:45: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. # define TIME64_TRACE1(format, var1) (fprintf(stderr, format, var1)) data/libplist-2.2.0/src/time64.c:153:51: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. # define TIME64_TRACE2(format, var1, var2) (fprintf(stderr, format, var1, var2)) data/libplist-2.2.0/src/time64.c:154:57: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. # define TIME64_TRACE3(format, var1, var2, var3) (fprintf(stderr, format, var1, var2, var3)) data/libplist-2.2.0/src/time64.c:795:5: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(result, TM64_ASCTIME_FORMAT, data/libplist-2.2.0/src/xplist.c:83:51: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define PLIST_XML_ERR(...) if (plist_xml_debug) { fprintf(stderr, "libplist[xmlparser] ERROR: " __VA_ARGS__); } data/libplist-2.2.0/src/xplist.c:166:23: [4] (format) snprintf: 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. val_len = snprintf(val, 64, "%"PRIu64, node_data->intval); data/libplist-2.2.0/src/xplist.c:168:23: [4] (format) snprintf: 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. val_len = snprintf(val, 64, "%"PRIi64, node_data->intval); data/libplist-2.2.0/src/xplist.c:231:23: [4] (format) snprintf: 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. val_len = snprintf(val, 64, "%"PRIu64, node_data->intval); data/libplist-2.2.0/src/xplist.c:233:23: [4] (format) snprintf: 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. val_len = snprintf(val, 64, "%"PRIi64, node_data->intval); data/libplist-2.2.0/src/xplist.c:388:5: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. sscanf(strval, PLIST_SSCANF_FORMAT, &btime->tm_year, &btime->tm_mon, &btime->tm_mday, &btime->tm_hour, &btime->tm_min, &btime->tm_sec); data/libplist-2.2.0/src/bplist.c:218:23: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char *env_debug = getenv("PLIST_BIN_DEBUG"); data/libplist-2.2.0/src/xplist.c:92:23: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char *env_debug = getenv("PLIST_XML_DEBUG"); data/libplist-2.2.0/src/base64.c:27:21: [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 signed char base64_table[256] = { data/libplist-2.2.0/src/base64.c:54: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. unsigned char input[3]; data/libplist-2.2.0/src/bplist.c:310: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(data->strval, *bnode, size); data/libplist-2.2.0/src/bplist.c:416: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(data->buff, *bnode, sizeof(uint8_t) * size); data/libplist-2.2.0/src/bytearray.c:59:2: [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*)ba->data) + ba->len, buf, len); data/libplist-2.2.0/src/plist.c:356: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(data->buff, val, length); data/libplist-2.2.0/src/plist.c:388: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(newdata, data, sizeof(struct plist_data_s)); data/libplist-2.2.0/src/plist.c:394: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(newdata->buff, data->buff, data->length); data/libplist-2.2.0/src/plist.c:862: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(*((uint8_t **) value), data->buff, *length * sizeof(uint8_t)); data/libplist-2.2.0/src/plist.c:1124: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(data->buff, value, length); data/libplist-2.2.0/src/time64.c:52: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 days_in_month[2][12] = { data/libplist-2.2.0/src/time64.c:62: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 wday_name[7][4] = { data/libplist-2.2.0/src/time64.c:66:8: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char mon_name[12][4] = { data/libplist-2.2.0/src/time64.c:109: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 dow_year_start[SOLAR_CYCLE_LENGTH] = { data/libplist-2.2.0/src/time64.c:418: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(dest, src, sizeof(*dest)); data/libplist-2.2.0/src/time64.c:450: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(dest, src, sizeof(*dest)); data/libplist-2.2.0/src/time64.c:468: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(result, static_result, sizeof(*result)); data/libplist-2.2.0/src/time64.c:487: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(result, static_result, sizeof(*result)); data/libplist-2.2.0/src/xplist.c:1302:29: [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 strval[32]; data/libplist-2.2.0/test/plist_cmp.c:103:15: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). iplist1 = fopen(file_in1, "rb"); data/libplist-2.2.0/test/plist_cmp.c:104:15: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). iplist2 = fopen(file_in2, "rb"); data/libplist-2.2.0/test/plist_test.c:58: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). iplist = fopen(file_in, "rb"); data/libplist-2.2.0/test/plist_test.c:113:18: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). oplist = fopen(file_out, "wb"); data/libplist-2.2.0/tools/plistutil.c:210:18: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). iplist = fopen(options->in_file, "rb"); data/libplist-2.2.0/tools/plistutil.c:251:17: [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(plist_out, plist_entire, read_size); data/libplist-2.2.0/tools/plistutil.c:267:17: [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(plist_out, plist_entire, read_size); data/libplist-2.2.0/tools/plistutil.c:279:28: [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 *oplist = fopen(options->out_file, "wb"); data/libplist-2.2.0/src/base64.c:77:37: [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 = (*size > 0) ? *size : strlen(buf); data/libplist-2.2.0/src/bplist.c:312: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). data->length = strlen(data->strval); data/libplist-2.2.0/src/plist.c:302: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). data->length = strlen(val); data/libplist-2.2.0/src/plist.c:311: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). data->length = strlen(val); data/libplist-2.2.0/src/plist.c:685: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). sdata.length = strlen(key); data/libplist-2.2.0/src/plist.c:898: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). assert(length == strlen(*val)); data/libplist-2.2.0/src/plist.c:912: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). assert(length == strlen(*val)); data/libplist-2.2.0/src/plist.c:1140:49: [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). plist_set_element_val(node, PLIST_KEY, val, strlen(val)); data/libplist-2.2.0/src/plist.c:1145: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). plist_set_element_val(node, PLIST_STRING, val, strlen(val)); data/libplist-2.2.0/src/xplist.c:906:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(p, tp->begin, len); data/libplist-2.2.0/src/xplist.c:1036:13: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(tag, p, taglen); data/libplist-2.2.0/src/xplist.c:1304:29: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(strval, str_content, length); data/libplist-2.2.0/tools/plistutil.c:173:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while(read(STDIN_FILENO, &ch, 1) > 0) ANALYSIS SUMMARY: Hits = 54 Lines analyzed = 9961 in approximately 0.31 seconds (32289 lines/second) Physical Source Lines of Code (SLOC) = 6783 Hits@level = [0] 55 [1] 13 [2] 27 [3] 2 [4] 12 [5] 0 Hits@level+ = [0+] 109 [1+] 54 [2+] 41 [3+] 14 [4+] 12 [5+] 0 Hits/KSLOC@level+ = [0+] 16.0696 [1+] 7.96108 [2+] 6.04452 [3+] 2.06398 [4+] 1.76913 [5+] 0 Dot directories skipped = 2 (--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.