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/dwz-0.13+20201015/sha1.h Examining data/dwz-0.13+20201015/hashtab.c Examining data/dwz-0.13+20201015/hashtab.h Examining data/dwz-0.13+20201015/testsuite/dwz.tests/two-typedef.h Examining data/dwz-0.13+20201015/testsuite/dwz.tests/odr-2.cc Examining data/dwz-0.13+20201015/testsuite/dwz.tests/two-typedef.c Examining data/dwz-0.13+20201015/testsuite/dwz.tests/odr-loc.cc Examining data/dwz-0.13+20201015/testsuite/dwz.tests/def2.c Examining data/dwz-0.13+20201015/testsuite/dwz.tests/pointer-size.c Examining data/dwz-0.13+20201015/testsuite/dwz.tests/varval.c Examining data/dwz-0.13+20201015/testsuite/dwz.tests/start.c Examining data/dwz-0.13+20201015/testsuite/dwz.tests/dw2-skip-prologue.c Examining data/dwz-0.13+20201015/testsuite/dwz.tests/min-2.c Examining data/dwz-0.13+20201015/testsuite/dwz.tests/def.h Examining data/dwz-0.13+20201015/testsuite/dwz.tests/hello.c Examining data/dwz-0.13+20201015/testsuite/dwz.tests/def.c Examining data/dwz-0.13+20201015/testsuite/dwz.tests/two-typedef-2.c Examining data/dwz-0.13+20201015/testsuite/dwz.tests/odr.cc Examining data/dwz-0.13+20201015/testsuite/dwz.tests/decl.c Examining data/dwz-0.13+20201015/testsuite/dwz.tests/min.c Examining data/dwz-0.13+20201015/testsuite/dwz.tests/odr.h Examining data/dwz-0.13+20201015/testsuite/dwz.tests/main.c Examining data/dwz-0.13+20201015/testsuite/dwz.tests/odr-loc-2.cc Examining data/dwz-0.13+20201015/sha1.c Examining data/dwz-0.13+20201015/iterators.h Examining data/dwz-0.13+20201015/dwz.c Examining data/dwz-0.13+20201015/dwarf2.h Examining data/dwz-0.13+20201015/dwarfnames.c FINAL RESULTS: data/dwz-0.13+20201015/dwz.c:13314:3: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy ((char *) &dso->scn[ehdr.e_shnum], name); data/dwz-0.13+20201015/dwz.c:13852:3: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy (shstrtab + shdr.sh_name, debug_sections[j].name); data/dwz-0.13+20201015/dwz.c:13909:7: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy (&buf[offset], prefix); data/dwz-0.13+20201015/dwz.c:13911:7: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy (&buf[offset], dso->filename); data/dwz-0.13+20201015/dwz.c:15711:3: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy (&buf[offset], tmpdir); data/dwz-0.13+20201015/dwz.c:15714:3: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy (&buf[offset], name); data/dwz-0.13+20201015/dwz.c:15717:3: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy (&buf[offset], template_suffix); data/dwz-0.13+20201015/dwz.c:14989:20: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. char *p1 = realpath (file, NULL); data/dwz-0.13+20201015/dwz.c:14990:20: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. char *p2 = realpath (multifile, NULL); data/dwz-0.13+20201015/dwz.c:16077:15: [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. int c = getopt_long (argc, argv, "m:o:qhl:L:M:r?v", dwz_options, &option_index); data/dwz-0.13+20201015/dwz.c:648:10: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char buf[9 + 3 * sizeof (int)]; data/dwz-0.13+20201015/dwz.c:651:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (buf, "DW_FORM_%u", form); data/dwz-0.13+20201015/dwz.c:660:10: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char buf[7 + 3 * sizeof (int)]; data/dwz-0.13+20201015/dwz.c:663:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (buf, "DW_OP_%u", op); data/dwz-0.13+20201015/dwz.c:672:10: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char buf[7 + 3 * sizeof (int)]; data/dwz-0.13+20201015/dwz.c:675:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (buf, "DW_AT_%u", at); data/dwz-0.13+20201015/dwz.c:684:10: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char buf[7 + 3 * sizeof (int)]; data/dwz-0.13+20201015/dwz.c:697:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (buf, "DW_UT_%u", ut); data/dwz-0.13+20201015/dwz.c:706:10: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char buf[9 + 3 * sizeof (int)]; data/dwz-0.13+20201015/dwz.c:719:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf (buf, "DW_LNCT_%u", lnct); data/dwz-0.13+20201015/dwz.c:788: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. static unsigned char *saved_new_data[SAVED_SECTIONS]; data/dwz-0.13+20201015/dwz.c:793: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. static unsigned char *alt_data[SAVED_SECTIONS]; data/dwz-0.13+20201015/dwz.c:867: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. static unsigned char multifile_sha1[0x14]; data/dwz-0.13+20201015/dwz.c:1606: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. d = ((unsigned char *) data/dwz-0.13+20201015/dwz.c:1617: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. d = ((unsigned char *) data/dwz-0.13+20201015/dwz.c:1829: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. f = ((char *) debug_sections[DEBUG_STR].data data/dwz-0.13+20201015/dwz.c:1842: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. f = ((char *) debug_sections[DEBUG_LINE_STR].data data/dwz-0.13+20201015/dwz.c:1890:37: [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. cu->cu_files[file_cnt].dir = (char *) dirt[d]; data/dwz-0.13+20201015/dwz.c:2242: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. return (char *) alt_data[DEBUG_STR] + strp; data/dwz-0.13+20201015/dwz.c:2246:10: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. return (char *) debug_sections[DEBUG_STR].data + strp; data/dwz-0.13+20201015/dwz.c:2254: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. return (char *) debug_sections[DEBUG_LINE_STR].data + line_strp; data/dwz-0.13+20201015/dwz.c:2529: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 (ref, &ref_buf, offsetof (struct dw_die, die_child)); data/dwz-0.13+20201015/dwz.c:2543:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy (ref, &ref_buf, offsetof (struct dw_die, die_child)); data/dwz-0.13+20201015/dwz.c:4810: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. if (strcmp ((char *) debug_sections[DEBUG_STR].data + value1, data/dwz-0.13+20201015/dwz.c:4811: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 *) debug_sections[DEBUG_STR].data + value2) data/dwz-0.13+20201015/dwz.c:5416:19: [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. return strcmp ((char *) debug_sections[DEBUG_STR].data + s1->off, data/dwz-0.13+20201015/dwz.c:5417: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 *) debug_sections[DEBUG_STR].data + s2->off) == 0; data/dwz-0.13+20201015/dwz.c:5507:32: [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. max_strp_off += strlen ((char *) debug_sections[DEBUG_STR].data data/dwz-0.13+20201015/dwz.c:5674:35: [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 int len = strlen ((char *) debug_sections[DEBUG_STR].data data/dwz-0.13+20201015/dwz.c:5737:30: [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 int len = strlen ((char *) debug_sections[DEBUG_STR].data data/dwz-0.13+20201015/dwz.c:5742: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 (p, debug_sections[DEBUG_STR].data + arr[i]->off, len); data/dwz-0.13+20201015/dwz.c:6105:4: [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 (ref, die, offsetof (struct dw_die, die_child)); data/dwz-0.13+20201015/dwz.c:9656: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. if (strcmp ((char *) debug_sections[DEBUG_STR].data + strp1, data/dwz-0.13+20201015/dwz.c:9657: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 *) debug_sections[DEBUG_STR].data + strp2) data/dwz-0.13+20201015/dwz.c:9850: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. = (unsigned char *) malloc (debug_sections[DEBUG_MACRO].new_size); data/dwz-0.13+20201015/dwz.c:9921: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 (dst, start, ptr - start); data/dwz-0.13+20201015/dwz.c:9931:4: [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 (dst, start, ptr - start); data/dwz-0.13+20201015/dwz.c:9971:4: [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 (*pp, s, p - s); data/dwz-0.13+20201015/dwz.c:9983:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy (*pp, s, p - s); data/dwz-0.13+20201015/dwz.c:10114: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. = (unsigned char *) malloc (debug_sections[DEBUG_MACRO].new_size); data/dwz-0.13+20201015/dwz.c:10159:8: [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 (dst, s, ptr - 1 - s); data/dwz-0.13+20201015/dwz.c:10172:8: [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 (dst, s, ptr - 4 - s); data/dwz-0.13+20201015/dwz.c:10178:8: [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 (dst, s, ptr - 1 - s); data/dwz-0.13+20201015/dwz.c:10197: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 (dst, s, ptr - s); data/dwz-0.13+20201015/dwz.c:10791: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 (newt, t, data/dwz-0.13+20201015/dwz.c:11334: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 (newt, arr[k], data/dwz-0.13+20201015/dwz.c:11439: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 (newt, arr[k], data/dwz-0.13+20201015/dwz.c:11814:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy (ptr, p, 4); data/dwz-0.13+20201015/dwz.c:11836: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 (ptr, p, 4); data/dwz-0.13+20201015/dwz.c:11842:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy (ptr, p, 4); data/dwz-0.13+20201015/dwz.c:11848:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy (ptr, p, len); data/dwz-0.13+20201015/dwz.c:11963:8: [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 (ptr, orig_ptr, inptr - orig_ptr); data/dwz-0.13+20201015/dwz.c:11981: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 (ptr, orig_ptr, inptr - orig_ptr); data/dwz-0.13+20201015/dwz.c:12106: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 (ptr, orig_ptr, inptr - 4 - orig_ptr); data/dwz-0.13+20201015/dwz.c:12222:4: [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 (ptr, orig_ptr, inptr - orig_ptr); data/dwz-0.13+20201015/dwz.c:12293: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 (ptr, p, 4); data/dwz-0.13+20201015/dwz.c:12299:8: [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 (ptr, p, 4); data/dwz-0.13+20201015/dwz.c:12305:8: [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 (ptr, p, len); data/dwz-0.13+20201015/dwz.c:12634:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy (loc, debug_sections[DEBUG_LOC].data, debug_sections[DEBUG_LOC].size); data/dwz-0.13+20201015/dwz.c:12650:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy (loc, debug_sections[DEBUG_LOCLISTS].data, data/dwz-0.13+20201015/dwz.c:12688: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 (ptr, inptr - 8, 8); data/dwz-0.13+20201015/dwz.c:12715:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy (aranges, debug_sections[DEBUG_ARANGES].data, data/dwz-0.13+20201015/dwz.c:12830: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. inptr = (unsigned char *) debug_sections[GDB_INDEX].data; data/dwz-0.13+20201015/dwz.c:13013: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 (ptr, inptr, 16); data/dwz-0.13+20201015/dwz.c:13028:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy (ptr, inptr, constoff - symboloff); data/dwz-0.13+20201015/dwz.c:13062:4: [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 (ptr + name, end + name, strend + 1 - (end + name)); data/dwz-0.13+20201015/dwz.c:13734: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 (filename, dso->filename, len); data/dwz-0.13+20201015/dwz.c:13735: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 (filename + len, ".#dwz#.XXXXXX", sizeof (".#dwz#.XXXXXX")); data/dwz-0.13+20201015/dwz.c:13736:12: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). fd = mkstemp (filename); data/dwz-0.13+20201015/dwz.c:13748: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). fd = open (file, O_RDWR | O_CREAT, 0600); data/dwz-0.13+20201015/dwz.c:13786:10: [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 (e_ident, dso->ehdr.e_ident, EI_NIDENT) == NULL data/dwz-0.13+20201015/dwz.c:13820: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 (data2, data1, sizeof (*data1)); data/dwz-0.13+20201015/dwz.c:13829:4: [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 (shstrtab, data1->d_buf, data/dwz-0.13+20201015/dwz.c:14241: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 (buf + buf_size, p, len); data/dwz-0.13+20201015/dwz.c:14307: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 buf[45]; /* Max header_len, see below. */ data/dwz-0.13+20201015/dwz.c:14466: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 (ptr, "<dwz>", 6); /* Zero entry empty dir path. */ data/dwz-0.13+20201015/dwz.c:14476:4: [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 (ptr, filearr[dirarr[i]]->file->dir, l); data/dwz-0.13+20201015/dwz.c:14486:4: [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 (ptr, file, l - 1); data/dwz-0.13+20201015/dwz.c:14512: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 (ptr, "<dwz>", 6); /* Zero entry empty file path. */ data/dwz-0.13+20201015/dwz.c:14528: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 (ptr, file, l); data/dwz-0.13+20201015/dwz.c:14815:8: [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 (file, O_RDONLY); data/dwz-0.13+20201015/dwz.c:14865:8: [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 (filename, file, len); data/dwz-0.13+20201015/dwz.c:14866:8: [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 (filename + len, ".#dwz#.XXXXXX", data/dwz-0.13+20201015/dwz.c:14868:14: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). fd2 = mkstemp (filename); data/dwz-0.13+20201015/dwz.c:15031:6: [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 (p5, "../", 3); data/dwz-0.13+20201015/dwz.c:15035: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 (p5, p4, len + 1); data/dwz-0.13+20201015/dwz.c:15047:8: [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 (debug_sections[GNU_DEBUGALTLINK].new_data, name, len); data/dwz-0.13+20201015/dwz.c:15048:8: [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 (debug_sections[GNU_DEBUGALTLINK].new_data + len, data/dwz-0.13+20201015/dwz.c:15157: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 note[0x24], *np; data/dwz-0.13+20201015/dwz.c:15346:8: [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 (multifile, O_RDWR | O_CREAT, 0600); data/dwz-0.13+20201015/dwz.c:15397:10: [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 (e_ident, multi_ehdr.e_ident, EI_NIDENT) == NULL data/dwz-0.13+20201015/dwz.c:15415:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy (np, "GNU", sizeof ("GNU")); data/dwz-0.13+20201015/dwz.c:15416:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy (np + 4, multifile_sha1, 0x14); data/dwz-0.13+20201015/dwz.c:15691:17: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). FILE *f = fopen (name, "w+"); data/dwz-0.13+20201015/dwz.c:15723:8: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). fd = mkstemp (buf); data/dwz-0.13+20201015/hashtab.c:552: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). FILE *f = fopen (name, "w"); data/dwz-0.13+20201015/hashtab.c:587: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). FILE *f = fopen (name, "r"); data/dwz-0.13+20201015/sha1.c:41:23: [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 unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; data/dwz-0.13+20201015/sha1.c:98:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy (&((char *) ctx->buffer)[bytes], fillbuf, (size - 2) * 4 - bytes); data/dwz-0.13+20201015/sha1.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 (&((char *) ctx->buffer)[left_over], buffer, add); data/dwz-0.13+20201015/sha1.c:144:4: [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 (ctx->buffer, data/dwz-0.13+20201015/sha1.c:162:26: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. sha1_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx); data/dwz-0.13+20201015/sha1.c:180: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 (&((char *) ctx->buffer)[left_over], buffer, len); data/dwz-0.13+20201015/sha1.c:186:4: [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 (ctx->buffer, &ctx->buffer[16], left_over); data/dwz-0.13+20201015/dwz.c:1831:18: [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). end = f + strlen (f) + 1; data/dwz-0.13+20201015/dwz.c:1844:18: [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). end = f + strlen (f) + 1; data/dwz-0.13+20201015/dwz.c:1899:21: [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 dir_len = strlen (cu->cu_files[file_cnt].dir); data/dwz-0.13+20201015/dwz.c:3396:23: [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 file_len = strlen (cu_file->file); data/dwz-0.13+20201015/dwz.c:3412:6: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). strlen (cu_file->dir) + 1, data/dwz-0.13+20201015/dwz.c:3429:6: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). strlen (cu->cu_comp_dir) + 1, data/dwz-0.13+20201015/dwz.c:3590: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). unsigned int l = strlen ((char *) p) + 1; data/dwz-0.13+20201015/dwz.c:5425: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). return iterative_hash (p, strlen (p), 0); data/dwz-0.13+20201015/dwz.c:5454:13: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). len = strlen ((char *) p); data/dwz-0.13+20201015/dwz.c:5507:23: [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). max_strp_off += strlen ((char *) debug_sections[DEBUG_STR].data data/dwz-0.13+20201015/dwz.c:5536:13: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). len = strlen ((char *) p); data/dwz-0.13+20201015/dwz.c:5577:10: [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 ((char *) p); data/dwz-0.13+20201015/dwz.c:5674:26: [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). unsigned int len = strlen ((char *) debug_sections[DEBUG_STR].data data/dwz-0.13+20201015/dwz.c:5737:21: [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). unsigned int len = strlen ((char *) debug_sections[DEBUG_STR].data data/dwz-0.13+20201015/dwz.c:9557: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). h = iterative_hash (le.file->file, strlen (le.file->file) + 1, h); data/dwz-0.13+20201015/dwz.c:9559:39: [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). h = iterative_hash (le.file->dir, strlen (le.file->dir) + 1, h); data/dwz-0.13+20201015/dwz.c:9784:24: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). unsigned int len = strlen ((char *) p); data/dwz-0.13+20201015/dwz.c:10040:14: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). len = strlen ((char *) p); data/dwz-0.13+20201015/dwz.c:10719:6: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). += strlen (refcu->cu_comp_dir) + 1; data/dwz-0.13+20201015/dwz.c:10742: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). die->die_size = strlen ((char *) ptr) + 1; data/dwz-0.13+20201015/dwz.c:11847:16: [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 ((char *) p) + 1; data/dwz-0.13+20201015/dwz.c:12304:21: [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 ((char *) p) + 1; data/dwz-0.13+20201015/dwz.c:13293:5: [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). + strlen (name) + 1); data/dwz-0.13+20201015/dwz.c:13579:12: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). len = strlen (debug_sections[i].name) + 1; data/dwz-0.13+20201015/dwz.c:13732: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). size_t len = strlen (dso->filename); data/dwz-0.13+20201015/dwz.c:13851:14: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). sh_name += strlen (debug_sections[j].name) + 1; data/dwz-0.13+20201015/dwz.c:13906:24: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). size_t buf_len = strlen (prefix) + strlen (dso->filename) + 1; data/dwz-0.13+20201015/dwz.c:13906: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). size_t buf_len = strlen (prefix) + strlen (dso->filename) + 1; data/dwz-0.13+20201015/dwz.c:13910:17: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). offset += strlen (prefix); data/dwz-0.13+20201015/dwz.c:13912:17: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). offset += strlen (dso->filename); data/dwz-0.13+20201015/dwz.c:14221:26: [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). unsigned int len = strlen ((char *) p) + 1; data/dwz-0.13+20201015/dwz.c:14363: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). direntrylen = strlen (filearr[i]->file->dir) + 1; data/dwz-0.13+20201015/dwz.c:14374:18: [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). filetbllen += strlen (file) + 1; data/dwz-0.13+20201015/dwz.c:14475:8: [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). l = strlen (filearr[dirarr[i]]->file->dir) + 1; data/dwz-0.13+20201015/dwz.c:14527: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). l = strlen (file) + 1; data/dwz-0.13+20201015/dwz.c:14859:21: [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 (file); data/dwz-0.13+20201015/dwz.c:15024:15: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). len = strlen (p4); data/dwz-0.13+20201015/dwz.c:15041:14: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). len = strlen (name) + 1; data/dwz-0.13+20201015/dwz.c:15699:14: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). name_len = strlen (name); data/dwz-0.13+20201015/dwz.c:15700:14: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). buf_len = (strlen (tmpdir) data/dwz-0.13+20201015/dwz.c:15702: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). + strlen (template_suffix) data/dwz-0.13+20201015/dwz.c:15712:13: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). offset += strlen (tmpdir); data/dwz-0.13+20201015/dwz.c:15718:13: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). offset += strlen (template_suffix); data/dwz-0.13+20201015/dwz.c:15879:13: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). word_len = strlen (s); data/dwz-0.13+20201015/dwz.c:15945:18: [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 += 2 + strlen (s); data/dwz-0.13+20201015/dwz.c:15951:15: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). len += 1 + strlen (s); data/dwz-0.13+20201015/hashtab.c:606:20: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). switch ((c = fgetc (f))) ANALYSIS SUMMARY: Hits = 161 Lines analyzed = 18753 in approximately 0.45 seconds (41705 lines/second) Physical Source Lines of Code (SLOC) = 15523 Hits@level = [0] 112 [1] 47 [2] 104 [3] 3 [4] 7 [5] 0 Hits@level+ = [0+] 273 [1+] 161 [2+] 114 [3+] 10 [4+] 7 [5+] 0 Hits/KSLOC@level+ = [0+] 17.5868 [1+] 10.3717 [2+] 7.34394 [3+] 0.644205 [4+] 0.450944 [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.