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/bamtools-2.5.1+dfsg/src/api/BamAlgorithms.h Examining data/bamtools-2.5.1+dfsg/src/api/BamAux.h Examining data/bamtools-2.5.1+dfsg/src/api/BamIndex.h Examining data/bamtools-2.5.1+dfsg/src/api/BamMultiReader.cpp Examining data/bamtools-2.5.1+dfsg/src/api/BamMultiReader.h Examining data/bamtools-2.5.1+dfsg/src/api/BamReader.cpp Examining data/bamtools-2.5.1+dfsg/src/api/BamReader.h Examining data/bamtools-2.5.1+dfsg/src/api/BamWriter.cpp Examining data/bamtools-2.5.1+dfsg/src/api/BamWriter.h Examining data/bamtools-2.5.1+dfsg/src/api/IBamIODevice.h Examining data/bamtools-2.5.1+dfsg/src/api/SamConstants.h Examining data/bamtools-2.5.1+dfsg/src/api/SamHeader.cpp Examining data/bamtools-2.5.1+dfsg/src/api/SamHeader.h Examining data/bamtools-2.5.1+dfsg/src/api/SamProgram.cpp Examining data/bamtools-2.5.1+dfsg/src/api/SamProgram.h Examining data/bamtools-2.5.1+dfsg/src/api/SamProgramChain.cpp Examining data/bamtools-2.5.1+dfsg/src/api/SamProgramChain.h Examining data/bamtools-2.5.1+dfsg/src/api/SamReadGroup.cpp Examining data/bamtools-2.5.1+dfsg/src/api/SamReadGroup.h Examining data/bamtools-2.5.1+dfsg/src/api/SamReadGroupDictionary.cpp Examining data/bamtools-2.5.1+dfsg/src/api/SamReadGroupDictionary.h Examining data/bamtools-2.5.1+dfsg/src/api/SamSequence.cpp Examining data/bamtools-2.5.1+dfsg/src/api/SamSequence.h Examining data/bamtools-2.5.1+dfsg/src/api/SamSequenceDictionary.cpp Examining data/bamtools-2.5.1+dfsg/src/api/SamSequenceDictionary.h Examining data/bamtools-2.5.1+dfsg/src/api/algorithms/Sort.h Examining data/bamtools-2.5.1+dfsg/src/api/api_global.h Examining data/bamtools-2.5.1+dfsg/src/api/internal/bam/BamHeader_p.cpp Examining data/bamtools-2.5.1+dfsg/src/api/internal/bam/BamHeader_p.h Examining data/bamtools-2.5.1+dfsg/src/api/internal/bam/BamMultiMerger_p.h Examining data/bamtools-2.5.1+dfsg/src/api/internal/bam/BamMultiReader_p.cpp Examining data/bamtools-2.5.1+dfsg/src/api/internal/bam/BamMultiReader_p.h Examining data/bamtools-2.5.1+dfsg/src/api/internal/bam/BamRandomAccessController_p.cpp Examining data/bamtools-2.5.1+dfsg/src/api/internal/bam/BamRandomAccessController_p.h Examining data/bamtools-2.5.1+dfsg/src/api/internal/bam/BamReader_p.cpp Examining data/bamtools-2.5.1+dfsg/src/api/internal/bam/BamReader_p.h Examining data/bamtools-2.5.1+dfsg/src/api/internal/bam/BamWriter_p.cpp Examining data/bamtools-2.5.1+dfsg/src/api/internal/bam/BamWriter_p.h Examining data/bamtools-2.5.1+dfsg/src/api/internal/index/BamIndexFactory_p.cpp Examining data/bamtools-2.5.1+dfsg/src/api/internal/index/BamIndexFactory_p.h Examining data/bamtools-2.5.1+dfsg/src/api/internal/index/BamStandardIndex_p.cpp Examining data/bamtools-2.5.1+dfsg/src/api/internal/index/BamStandardIndex_p.h Examining data/bamtools-2.5.1+dfsg/src/api/internal/index/BamToolsIndex_p.cpp Examining data/bamtools-2.5.1+dfsg/src/api/internal/index/BamToolsIndex_p.h Examining data/bamtools-2.5.1+dfsg/src/api/internal/io/BamDeviceFactory_p.cpp Examining data/bamtools-2.5.1+dfsg/src/api/internal/io/BamDeviceFactory_p.h Examining data/bamtools-2.5.1+dfsg/src/api/internal/io/BamFile_p.cpp Examining data/bamtools-2.5.1+dfsg/src/api/internal/io/BamFile_p.h Examining data/bamtools-2.5.1+dfsg/src/api/internal/io/BamFtp_p.cpp Examining data/bamtools-2.5.1+dfsg/src/api/internal/io/BamFtp_p.h Examining data/bamtools-2.5.1+dfsg/src/api/internal/io/BamHttp_p.cpp Examining data/bamtools-2.5.1+dfsg/src/api/internal/io/BamHttp_p.h Examining data/bamtools-2.5.1+dfsg/src/api/internal/io/BamPipe_p.cpp Examining data/bamtools-2.5.1+dfsg/src/api/internal/io/BamPipe_p.h Examining data/bamtools-2.5.1+dfsg/src/api/internal/io/BgzfStream_p.cpp Examining data/bamtools-2.5.1+dfsg/src/api/internal/io/BgzfStream_p.h Examining data/bamtools-2.5.1+dfsg/src/api/internal/io/ByteArray_p.cpp Examining data/bamtools-2.5.1+dfsg/src/api/internal/io/ByteArray_p.h Examining data/bamtools-2.5.1+dfsg/src/api/internal/io/HostAddress_p.cpp Examining data/bamtools-2.5.1+dfsg/src/api/internal/io/HostAddress_p.h Examining data/bamtools-2.5.1+dfsg/src/api/internal/io/HostInfo_p.cpp Examining data/bamtools-2.5.1+dfsg/src/api/internal/io/HostInfo_p.h Examining data/bamtools-2.5.1+dfsg/src/api/internal/io/HttpHeader_p.cpp Examining data/bamtools-2.5.1+dfsg/src/api/internal/io/HttpHeader_p.h Examining data/bamtools-2.5.1+dfsg/src/api/internal/io/ILocalIODevice_p.cpp Examining data/bamtools-2.5.1+dfsg/src/api/internal/io/ILocalIODevice_p.h Examining data/bamtools-2.5.1+dfsg/src/api/internal/io/NetUnix_p.h Examining data/bamtools-2.5.1+dfsg/src/api/internal/io/NetWin_p.h Examining data/bamtools-2.5.1+dfsg/src/api/internal/io/RollingBuffer_p.cpp Examining data/bamtools-2.5.1+dfsg/src/api/internal/io/RollingBuffer_p.h Examining data/bamtools-2.5.1+dfsg/src/api/internal/io/TcpSocketEngine_p.cpp Examining data/bamtools-2.5.1+dfsg/src/api/internal/io/TcpSocketEngine_p.h Examining data/bamtools-2.5.1+dfsg/src/api/internal/io/TcpSocketEngine_unix_p.cpp Examining data/bamtools-2.5.1+dfsg/src/api/internal/io/TcpSocketEngine_win_p.cpp Examining data/bamtools-2.5.1+dfsg/src/api/internal/io/TcpSocket_p.cpp Examining data/bamtools-2.5.1+dfsg/src/api/internal/io/TcpSocket_p.h Examining data/bamtools-2.5.1+dfsg/src/api/internal/sam/SamFormatParser_p.cpp Examining data/bamtools-2.5.1+dfsg/src/api/internal/sam/SamFormatParser_p.h Examining data/bamtools-2.5.1+dfsg/src/api/internal/sam/SamFormatPrinter_p.cpp Examining data/bamtools-2.5.1+dfsg/src/api/internal/sam/SamFormatPrinter_p.h Examining data/bamtools-2.5.1+dfsg/src/api/internal/sam/SamHeaderValidator_p.cpp Examining data/bamtools-2.5.1+dfsg/src/api/internal/sam/SamHeaderValidator_p.h Examining data/bamtools-2.5.1+dfsg/src/api/internal/sam/SamHeaderVersion_p.h Examining data/bamtools-2.5.1+dfsg/src/api/internal/utils/BamException_p.cpp Examining data/bamtools-2.5.1+dfsg/src/api/internal/utils/BamException_p.h Examining data/bamtools-2.5.1+dfsg/src/api/BamAlignment.h Examining data/bamtools-2.5.1+dfsg/src/api/BamConstants.h Examining data/bamtools-2.5.1+dfsg/src/api/BamAlignment.cpp Examining data/bamtools-2.5.1+dfsg/src/shared/bamtools_global.h Examining data/bamtools-2.5.1+dfsg/src/toolkit/bamtools.cpp Examining data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_convert.cpp Examining data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_convert.h Examining data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_count.cpp Examining data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_count.h Examining data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_coverage.cpp Examining data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_coverage.h Examining data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_filter.h Examining data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_header.cpp Examining data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_header.h Examining data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_index.cpp Examining data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_index.h Examining data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_merge.cpp Examining data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_merge.h Examining data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_random.cpp Examining data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_random.h Examining data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_resolve.h Examining data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_revert.cpp Examining data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_revert.h Examining data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_sort.cpp Examining data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_sort.h Examining data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_split.cpp Examining data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_split.h Examining data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_stats.cpp Examining data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_stats.h Examining data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_tool.h Examining data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_filter.cpp Examining data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_resolve.cpp Examining data/bamtools-2.5.1+dfsg/src/utils/bamtools_fasta.cpp Examining data/bamtools-2.5.1+dfsg/src/utils/bamtools_fasta.h Examining data/bamtools-2.5.1+dfsg/src/utils/bamtools_filter_engine.h Examining data/bamtools-2.5.1+dfsg/src/utils/bamtools_filter_properties.h Examining data/bamtools-2.5.1+dfsg/src/utils/bamtools_filter_ruleparser.h Examining data/bamtools-2.5.1+dfsg/src/utils/bamtools_options.cpp Examining data/bamtools-2.5.1+dfsg/src/utils/bamtools_options.h Examining data/bamtools-2.5.1+dfsg/src/utils/bamtools_pileup_engine.cpp Examining data/bamtools-2.5.1+dfsg/src/utils/bamtools_pileup_engine.h Examining data/bamtools-2.5.1+dfsg/src/utils/bamtools_utilities.cpp Examining data/bamtools-2.5.1+dfsg/src/utils/bamtools_utilities.h Examining data/bamtools-2.5.1+dfsg/src/utils/bamtools_variant.h Examining data/bamtools-2.5.1+dfsg/src/utils/utils_global.h FINAL RESULTS: data/bamtools-2.5.1+dfsg/src/api/BamAlignment.h:247:5: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(originalTagData.Buffer + tagDataLength, newTag.data()); data/bamtools-2.5.1+dfsg/src/api/BamAlignment.h:296:5: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(originalTagData.Buffer + tagDataLength, newTag.data()); data/bamtools-2.5.1+dfsg/src/api/BamAlignment.h:354:5: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(originalTagData.Buffer + tagDataLength, (const char*)newTagBase); data/bamtools-2.5.1+dfsg/src/utils/bamtools_options.h:41:9: [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. #define snprintf _snprintf data/bamtools-2.5.1+dfsg/src/utils/bamtools_options.h:41:18: [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. #define snprintf _snprintf data/bamtools-2.5.1+dfsg/src/utils/bamtools_utilities.cpp:321:5: [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(cstr, source.c_str()); data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_random.cpp:183:9: [3] (random) srand: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srand(m_settings->RandomNumberSeed); data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_random.cpp:185:9: [3] (random) srand: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srand(time(NULL)); data/bamtools-2.5.1+dfsg/src/api/BamAlignment.cpp:307:25: [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(&numElements, &tagData[i], sizeof(uint32_t)); data/bamtools-2.5.1+dfsg/src/api/BamAlignment.cpp:351:9: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy((char*)(TagData.data()), tagData, tagDataLength); data/bamtools-2.5.1+dfsg/src/api/BamAlignment.cpp:879: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(newTagData.Buffer, pOriginalTagData, numBytesParsed); data/bamtools-2.5.1+dfsg/src/api/BamAlignment.cpp:891: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(newTagData.Buffer + beginningTagDataLength, pTagData, endTagDataLength); data/bamtools-2.5.1+dfsg/src/api/BamAlignment.cpp:1093: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(&numElements, pTagData, sizeof(uint32_t)); // already endian-swapped, if needed data/bamtools-2.5.1+dfsg/src/api/BamAlignment.h:234: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 valueBuffer[sizeof(T)]; data/bamtools-2.5.1+dfsg/src/api/BamAlignment.h:243: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(originalTagData.Buffer, TagData.c_str(), data/bamtools-2.5.1+dfsg/src/api/BamAlignment.h:248: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(originalTagData.Buffer + tagDataLength + newTag.size(), un.valueBuffer, sizeof(T)); data/bamtools-2.5.1+dfsg/src/api/BamAlignment.h:292: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(originalTagData.Buffer, TagData.c_str(), data/bamtools-2.5.1+dfsg/src/api/BamAlignment.h:337: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 newTagBase[Constants::BAM_TAG_ARRAYBASE_SIZE]; data/bamtools-2.5.1+dfsg/src/api/BamAlignment.h:338: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(newTagBase, tag.c_str(), Constants::BAM_TAG_TAGSIZE); data/bamtools-2.5.1+dfsg/src/api/BamAlignment.h:344: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(newTagBase + 4, &numElements, sizeof(int32_t)); data/bamtools-2.5.1+dfsg/src/api/BamAlignment.h:350: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(originalTagData.Buffer, TagData.c_str(), data/bamtools-2.5.1+dfsg/src/api/BamAlignment.h:360: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(originalTagData.Buffer + elementsBeginOffset + i * sizeof(T), &value, sizeof(T)); data/bamtools-2.5.1+dfsg/src/api/BamAlignment.h:500: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(&destination, pTagData, destinationLength); data/bamtools-2.5.1+dfsg/src/api/BamAlignment.h:537: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((char*)destination.data(), pTagData, dataLength); data/bamtools-2.5.1+dfsg/src/api/BamAlignment.h:625: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(&numElements, pTagData, sizeof(int32_t)); data/bamtools-2.5.1+dfsg/src/api/BamAlignment.h:633: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(&value, pTagData, sizeof(T)); data/bamtools-2.5.1+dfsg/src/api/BamAux.h:286:18: [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 valueBuffer[sizeof(double)]; data/bamtools-2.5.1+dfsg/src/api/BamAux.h:324:18: [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 valueBuffer[sizeof(float)]; data/bamtools-2.5.1+dfsg/src/api/BamAux.h:358:18: [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 valueBuffer[sizeof(signed int)]; data/bamtools-2.5.1+dfsg/src/api/BamAux.h:392:18: [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 valueBuffer[sizeof(signed short)]; data/bamtools-2.5.1+dfsg/src/api/BamAux.h:424:18: [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 valueBuffer[sizeof(unsigned int)]; data/bamtools-2.5.1+dfsg/src/api/BamAux.h:458:18: [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 valueBuffer[sizeof(unsigned short)]; data/bamtools-2.5.1+dfsg/src/api/internal/bam/BamHeader_p.cpp:46: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[Constants::BAM_HEADER_MAGIC_LENGTH]; data/bamtools-2.5.1+dfsg/src/api/internal/bam/BamHeader_p.cpp:86: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[sizeof(uint32_t)]; data/bamtools-2.5.1+dfsg/src/api/internal/bam/BamReader_p.cpp:340:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(buf.Buffer, new_data.c_str(), buf.NumBytes - 8 - fake_bytes); data/bamtools-2.5.1+dfsg/src/api/internal/bam/BamReader_p.cpp:349: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[sizeof(uint32_t)]; data/bamtools-2.5.1+dfsg/src/api/internal/bam/BamReader_p.cpp:357: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 x[Constants::BAM_CORE_SIZE]; data/bamtools-2.5.1+dfsg/src/api/internal/bam/BamReader_p.cpp:434: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[sizeof(uint32_t)]; data/bamtools-2.5.1+dfsg/src/api/internal/bam/BamWriter_p.cpp:329: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(cigarData, packedCigar.data(), packedCigarLength); data/bamtools-2.5.1+dfsg/src/api/internal/bam/BamWriter_p.cpp:372: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(tagData, al.TagData.data(), tagDataLength); data/bamtools-2.5.1+dfsg/src/api/internal/bam/BamWriter_p.cpp:421:21: [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(&numElements, &tagData[i], sizeof(uint32_t)); data/bamtools-2.5.1+dfsg/src/api/internal/bam/BamWriter_p.cpp:474: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(cigarData, packedCigar.data(), packedCigarLength); data/bamtools-2.5.1+dfsg/src/api/internal/index/BamStandardIndex_p.cpp:162: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((char*)&chunkStart, m_resources.Buffer + offset, sizeof(uint64_t)); data/bamtools-2.5.1+dfsg/src/api/internal/index/BamStandardIndex_p.cpp:164: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((char*)&chunkStop, m_resources.Buffer + offset, sizeof(uint64_t)); data/bamtools-2.5.1+dfsg/src/api/internal/index/BamStandardIndex_p.cpp:238: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 magic[4]; data/bamtools-2.5.1+dfsg/src/api/internal/index/BamToolsIndex_p.cpp:77: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 magic[4]; data/bamtools-2.5.1+dfsg/src/api/internal/io/BamFile_p.cpp:45:20: [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). m_stream = fopen(m_filename.c_str(), "rb"); data/bamtools-2.5.1+dfsg/src/api/internal/io/BamFile_p.cpp:47:20: [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). m_stream = fopen(m_filename.c_str(), "wb"); data/bamtools-2.5.1+dfsg/src/api/internal/io/BamFile_p.cpp:49:20: [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). m_stream = fopen(m_filename.c_str(), "w+b"); data/bamtools-2.5.1+dfsg/src/api/internal/io/BamFtp_p.cpp:294:57: [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). const uint8_t portUpper = static_cast<uint8_t>(std::atoi(fields[4].c_str())); data/bamtools-2.5.1+dfsg/src/api/internal/io/BamFtp_p.cpp:295:57: [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). const uint8_t portLower = static_cast<uint8_t>(std::atoi(fields[5].c_str())); data/bamtools-2.5.1+dfsg/src/api/internal/io/BamHttp_p.cpp:444:60: [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). m_rangeEndPosition = m_filePosition + std::atoi(contentLengthString.c_str()); data/bamtools-2.5.1+dfsg/src/api/internal/io/BamHttp_p.cpp:528:34: [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). m_fileEndPosition = std::atoi(contentLengthString.c_str()) - 1; data/bamtools-2.5.1+dfsg/src/api/internal/io/BgzfStream_p.cpp:182: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(m_uncompressedBlock.Buffer, m_uncompressedBlock.Buffer + inputLength, remaining); data/bamtools-2.5.1+dfsg/src/api/internal/io/BgzfStream_p.cpp:315: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(output, m_uncompressedBlock.Buffer + m_blockOffset, copyLength); data/bamtools-2.5.1+dfsg/src/api/internal/io/BgzfStream_p.cpp:344: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 header[Constants::BGZF_BLOCK_HEADER_LENGTH]; data/bamtools-2.5.1+dfsg/src/api/internal/io/BgzfStream_p.cpp:369: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(m_compressedBlock.Buffer, header, Constants::BGZF_BLOCK_HEADER_LENGTH); data/bamtools-2.5.1+dfsg/src/api/internal/io/BgzfStream_p.cpp:455: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(buffer + m_blockOffset, input, copyLength); data/bamtools-2.5.1+dfsg/src/api/internal/io/HostAddress_p.cpp:68:26: [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 value = std::atoi(addressFields.at(i).c_str()); data/bamtools-2.5.1+dfsg/src/api/internal/io/HostInfo_p.cpp:113:61: [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). const uint16_t portNum = static_cast<uint16_t>(std::atoi(port.c_str())); data/bamtools-2.5.1+dfsg/src/api/internal/io/HostInfo_p.cpp:146: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 hbuf[NI_MAXHOST]; data/bamtools-2.5.1+dfsg/src/api/internal/io/HostInfo_p.cpp:147: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 serv[NI_MAXSERV]; data/bamtools-2.5.1+dfsg/src/api/internal/io/HttpHeader_p.cpp:386:25: [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). m_statusCode = std::atoi(temp.c_str()); data/bamtools-2.5.1+dfsg/src/api/internal/io/RollingBuffer_p.cpp:214:19: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. if (dest) memcpy(dest + bytesReadSoFar, readPtr, blockBytes); data/bamtools-2.5.1+dfsg/src/api/internal/io/RollingBuffer_p.cpp:237: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(dest + bytesReadSoFar, readPtr, bytesToRead); data/bamtools-2.5.1+dfsg/src/api/internal/io/RollingBuffer_p.cpp:316: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(writePtr, src, n); data/bamtools-2.5.1+dfsg/src/api/internal/io/TcpSocketEngine_unix_p.cpp:58: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(&sockAddrIPv6.sin6_addr.s6_addr, &ip6, sizeof(ip6)); data/bamtools-2.5.1+dfsg/src/api/internal/io/TcpSocketEngine_win_p.cpp:46: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(&sockAddrIPv6.sin6_addr.s6_addr, &ip6, sizeof(ip6)); data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_convert.cpp:227:17: [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). outFile.open(m_settings->OutputFilename.c_str()); data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_coverage.cpp:111:17: [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). outFile.open(m_settings->OutputFilename.c_str()); data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_filter.cpp:526:20: [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* inFile = fopen(m_settings->ScriptFilename.c_str(), "rb"); data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_filter.cpp:534: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[1024]; data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_resolve.cpp:424:14: [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). m_stream.open(filename.c_str(), std::ifstream::in); data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_resolve.cpp:497:14: [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). m_stream.open(filename.c_str(), std::ofstream::out); data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_resolve.cpp:575:14: [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). m_stream.open(filename.c_str(), std::ifstream::in); data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_resolve.cpp:775:14: [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). m_stream.open(filename.c_str(), std::ofstream::out); data/bamtools-2.5.1+dfsg/src/utils/bamtools_fasta.cpp:141: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[1024]; data/bamtools-2.5.1+dfsg/src/utils/bamtools_fasta.cpp:207:23: [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). IndexStream = fopen(indexFilename.c_str(), "wb"); data/bamtools-2.5.1+dfsg/src/utils/bamtools_fasta.cpp:351: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[1024]; data/bamtools-2.5.1+dfsg/src/utils/bamtools_fasta.cpp:379: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[1024]; data/bamtools-2.5.1+dfsg/src/utils/bamtools_fasta.cpp:500: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[1024]; data/bamtools-2.5.1+dfsg/src/utils/bamtools_fasta.cpp:543: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). Stream = fopen(filename.c_str(), "rb"); data/bamtools-2.5.1+dfsg/src/utils/bamtools_fasta.cpp:553:23: [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). IndexStream = fopen(indexFilename.c_str(), "rb"); data/bamtools-2.5.1+dfsg/src/utils/bamtools_options.cpp:67: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 argumentBuffer[ARGUMENT_LENGTH + 1]; data/bamtools-2.5.1+dfsg/src/utils/bamtools_options.cpp:70: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 indentBuffer[MAX_LINE_LENGTH - DESC_LENGTH + 1]; data/bamtools-2.5.1+dfsg/src/utils/bamtools_utilities.cpp:105:29: [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). startPos = std::atoi(regionString.substr(foundFirstColon + 1).c_str()); data/bamtools-2.5.1+dfsg/src/utils/bamtools_utilities.cpp:114:29: [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). startPos = std::atoi( data/bamtools-2.5.1+dfsg/src/utils/bamtools_utilities.cpp:125:32: [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). stopPos = std::atoi(regionString.substr(foundRangeDots + 2).c_str()); data/bamtools-2.5.1+dfsg/src/utils/bamtools_utilities.cpp:133:32: [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). stopPos = std::atoi(regionString.substr(foundSecondColon + 1).c_str()); data/bamtools-2.5.1+dfsg/src/utils/bamtools_utilities.cpp:216:29: [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). startPos = std::atoi(regionString.substr(foundFirstColon + 1).c_str()); data/bamtools-2.5.1+dfsg/src/utils/bamtools_utilities.cpp:225:29: [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). startPos = std::atoi( data/bamtools-2.5.1+dfsg/src/utils/bamtools_utilities.cpp:236:32: [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). stopPos = std::atoi(regionString.substr(foundRangeDots + 2).c_str()); data/bamtools-2.5.1+dfsg/src/utils/bamtools_utilities.cpp:244:32: [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). stopPos = std::atoi(regionString.substr(foundSecondColon + 1).c_str()); data/bamtools-2.5.1+dfsg/src/api/BamAlignment.h:534: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). const unsigned int dataLength = strlen(pTagData); data/bamtools-2.5.1+dfsg/src/api/internal/io/TcpSocketEngine_unix_p.cpp:191:29: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). const std::size_t ret = read(m_socketDescriptor, dest, max); data/bamtools-2.5.1+dfsg/src/toolkit/bamtools_filter.cpp:539:19: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). char ch = fgetc(inFile); data/bamtools-2.5.1+dfsg/src/utils/bamtools_fasta.cpp:85: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). int seqLength = strlen(sequence); data/bamtools-2.5.1+dfsg/src/utils/bamtools_fasta.cpp:153:14: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). char c = fgetc(Stream); data/bamtools-2.5.1+dfsg/src/utils/bamtools_fasta.cpp:157:13: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = fgetc(Stream); data/bamtools-2.5.1+dfsg/src/utils/bamtools_fasta.cpp:266:16: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). base = getc(Stream); data/bamtools-2.5.1+dfsg/src/utils/bamtools_fasta.cpp:383:19: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). char ch = fgetc(Stream); data/bamtools-2.5.1+dfsg/src/utils/bamtools_fasta.cpp:504:18: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). char c = fgetc(IndexStream); ANALYSIS SUMMARY: Hits = 102 Lines analyzed = 30282 in approximately 0.65 seconds (46357 lines/second) Physical Source Lines of Code (SLOC) = 17935 Hits@level = [0] 21 [1] 9 [2] 85 [3] 2 [4] 6 [5] 0 Hits@level+ = [0+] 123 [1+] 102 [2+] 93 [3+] 8 [4+] 6 [5+] 0 Hits/KSLOC@level+ = [0+] 6.8581 [1+] 5.6872 [2+] 5.18539 [3+] 0.446055 [4+] 0.334541 [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.