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/mtx-1.3.12/scsi_win32.c Examining data/mtx-1.3.12/scsi_hpux.c Examining data/mtx-1.3.12/mtx.h Examining data/mtx-1.3.12/nsmhack.c Examining data/mtx-1.3.12/scsi_sun.c Examining data/mtx-1.3.12/scsi_sgi.c Examining data/mtx-1.3.12/scsieject.c Examining data/mtx-1.3.12/mtxl.h Examining data/mtx-1.3.12/sg_err.h Examining data/mtx-1.3.12/scsi_aix.c Examining data/mtx-1.3.12/msvc/config.h Examining data/mtx-1.3.12/scsi_linux.c Examining data/mtx-1.3.12/scsi_freebsd.c Examining data/mtx-1.3.12/mam2debug.c Examining data/mtx-1.3.12/sg_err.c Examining data/mtx-1.3.12/vms/defs.h Examining data/mtx-1.3.12/vms/scsi.c Examining data/mtx-1.3.12/vms/ldrset.c Examining data/mtx-1.3.12/mtx.c Examining data/mtx-1.3.12/mam2debug2.c Examining data/mtx-1.3.12/du/defs.h Examining data/mtx-1.3.12/du/scsi.c Examining data/mtx-1.3.12/mtxl.c Examining data/mtx-1.3.12/loaderinfo.c Examining data/mtx-1.3.12/tapeinfo.c Examining data/mtx-1.3.12/scsitape.c FINAL RESULTS: data/mtx-1.3.12/mtxl.c:177:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(TargetPointer,"%s: ",argv0); data/mtx-1.3.12/mtxl.c:229:2: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, FormatBuffer, ArgumentPointer); data/mtx-1.3.12/sg_err.c:456:17: [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. fprintf(OUTP, additional2[i].text, sense_buffer[13]); data/mtx-1.3.12/vms/scsi.c:396: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(SymbolValue, data/mtx-1.3.12/mtx.c:910:12: [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. device = getenv("CHANGER"); data/mtx-1.3.12/mtx.c:913:13: [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. device = getenv("TAPE"); data/mtx-1.3.12/nsmhack.c:107:12: [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. device=getenv("STAPE"); data/mtx-1.3.12/nsmhack.c:109:14: [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. device=getenv("TAPE"); data/mtx-1.3.12/scsieject.c:97:17: [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. if ((device = getenv("STAPE")) == NULL && data/mtx-1.3.12/scsieject.c:98:14: [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. (device = getenv("TAPE")) == NULL) data/mtx-1.3.12/scsitape.c:152:12: [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. device = getenv("STAPE"); data/mtx-1.3.12/scsitape.c:155:13: [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. device = getenv("TAPE"); data/mtx-1.3.12/vms/ldrset.c:90:7: [3] (random) setstate: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. int setstate) data/mtx-1.3.12/vms/ldrset.c:98:7: [3] (random) setstate: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. if (setstate) data/mtx-1.3.12/du/scsi.c:69: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). if ((fd = open(DeviceName, O_RDONLY | O_NDELAY, 0)) >= 0) data/mtx-1.3.12/du/scsi.c:86: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). if ((fd = open(DEV_CAM, O_RDWR, 0)) >= 0 || data/mtx-1.3.12/du/scsi.c:87:11: [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(DEV_CAM, O_RDONLY, 0)) >= 0) data/mtx-1.3.12/du/scsi.c:145:9: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void) memcpy((unsigned char *) ccb.cam_cdb_io.cam_cdb_bytes, data/mtx-1.3.12/loaderinfo.c:48: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 *PeripheralDeviceType[32] = data/mtx-1.3.12/loaderinfo.c:90: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 MediumTransportElementAddress[2]; data/mtx-1.3.12/loaderinfo.c:91: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 NumMediumTransportElements[2]; data/mtx-1.3.12/loaderinfo.c:92: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 FirstStorageElementAdddress[2]; data/mtx-1.3.12/loaderinfo.c:93: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 NumStorageElements[2]; data/mtx-1.3.12/loaderinfo.c:94: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 FirstImportExportElementAddress[2]; data/mtx-1.3.12/loaderinfo.c:95: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 NumImportExportElements[2]; data/mtx-1.3.12/loaderinfo.c:96: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 FirstDataTransferElementAddress[2]; data/mtx-1.3.12/loaderinfo.c:97: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 NumDataTransferElements[2]; data/mtx-1.3.12/loaderinfo.c:98: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 Reserved[2]; data/mtx-1.3.12/loaderinfo.c:124: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 Reserved[4]; /* more reserved data */ data/mtx-1.3.12/loaderinfo.c:129: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 Reserved2[4]; /* more reserved data */ data/mtx-1.3.12/mam2debug.c:42: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 buff_descriptor[4]; data/mtx-1.3.12/mam2debug.c:109:11: [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(argv[2],O_CREAT|O_WRONLY); data/mtx-1.3.12/mam2debug2.c:42: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 buff_descriptor[4]; data/mtx-1.3.12/mam2debug2.c:109:11: [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(argv[2],O_CREAT|O_WRONLY); data/mtx-1.3.12/mtx.c:43: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 *PeripheralDeviceType[32] = data/mtx-1.3.12/mtx.c:883:11: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). retval = atoi(arg); data/mtx-1.3.12/mtx.h:231: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. typedef unsigned char CDB_T[12]; data/mtx-1.3.12/mtx.h:301: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 VendorIdentification[8]; /* Bytes 8-15 */ data/mtx-1.3.12/mtx.h:302: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 ProductIdentification[16]; /* Bytes 16-31 */ data/mtx-1.3.12/mtx.h:303: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 ProductRevisionLevel[4]; /* Bytes 32-35 */ data/mtx-1.3.12/mtx.h:304: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 FullProductRevisionLevel[19]; /* bytes 36-54 */ data/mtx-1.3.12/mtx.h:341: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 Information[4]; /* Bytes 3-6 */ data/mtx-1.3.12/mtx.h:343: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 CommandSpecificInformation[4]; /* Bytes 8-11 */ data/mtx-1.3.12/mtx.h:360: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 FieldData[2]; /* Byte 16,17 */ data/mtx-1.3.12/mtx.h:426: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 FirstElementAddressReported[2]; /* Bytes 0-1 */ data/mtx-1.3.12/mtx.h:427: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 NumberOfElementsAvailable[2]; /* Bytes 2-3 */ data/mtx-1.3.12/mtx.h:429: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 ByteCountOfReportAvailable[3]; /* Bytes 5-7 */ data/mtx-1.3.12/mtx.h:446: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 ElementDescriptorLength[2]; /* Bytes 2-3 */ data/mtx-1.3.12/mtx.h:448: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 ByteCountOfDescriptorDataAvailable[3]; /* Bytes 5-7 */ data/mtx-1.3.12/mtx.h:458: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 ElementDescriptorLength[2]; /* Bytes 2-3 */ data/mtx-1.3.12/mtx.h:460: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 ByteCountOfDescriptorDataAvailable[3]; /* Bytes 5-7 */ data/mtx-1.3.12/mtx.h:468: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 ElementAddress[2]; /* Bytes 0-1 */ data/mtx-1.3.12/mtx.h:495: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 SourceStorageElementAddress[2]; /* Bytes 10-11 */ data/mtx-1.3.12/mtx.h:497: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 Reserved[4]; /* Bytes 12-15 */ data/mtx-1.3.12/mtx.h:505: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 ElementAddress[2]; /* Bytes 0-1 */ data/mtx-1.3.12/mtx.h:532: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 SourceStorageElementAddress[2]; /* Bytes 10-11 */ data/mtx-1.3.12/mtx.h:533: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 PrimaryVolumeTag[36]; /* barcode */ data/mtx-1.3.12/mtx.h:534: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 AlternateVolumeTag[36]; data/mtx-1.3.12/mtx.h:536: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 Reserved[4]; /* 4 extra bytes? */ data/mtx-1.3.12/mtx.h:547: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. typedef unsigned char barcode[37]; data/mtx-1.3.12/mtx.h:590: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 reserved2[2]; data/mtx-1.3.12/mtx.h:591: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 command_code[4]; data/mtx-1.3.12/mtx.h:592: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 command_params[2048]; /* egregious overkill. */ data/mtx-1.3.12/mtx.h:602: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 command_code[4]; data/mtx-1.3.12/mtx.h:603: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 ces_code[2]; data/mtx-1.3.12/mtx.h:604: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 return_data[0xffff]; /* egregioius overkill */ data/mtx-1.3.12/mtxl.c:168:2: [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 FormatBuffer[FORMAT_BUF_LEN]; data/mtx-1.3.12/mtxl.c:402: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_buffer[136]; data/mtx-1.3.12/mtxl.c:844: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(&ESBuf, DataPointer, sizeof(ElementStatusPage_T)); data/mtx-1.3.12/nsmhack.c:93:10: [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). retval=atoi(arg); data/mtx-1.3.12/scsi_aix.c:25: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). int DeviceFD = open(DeviceName, 0); data/mtx-1.3.12/scsi_freebsd.c:70: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(cdb,CDB,CDB_Length); data/mtx-1.3.12/scsi_freebsd.c:106: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(RequestSense,(void *) &ccb->csio.sense_data, data/mtx-1.3.12/scsi_hpux.c:48: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). int DeviceFD = open(DeviceName, O_RDWR | O_NDELAY); data/mtx-1.3.12/scsi_hpux.c:110: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(Command.cdb, CDB, CDB_Length); data/mtx-1.3.12/scsi_hpux.c:130: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(RequestSense, Command.sense, Command.sense_xfer); data/mtx-1.3.12/scsi_linux.c:67: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). int DeviceFD = open(DeviceName, O_RDWR); data/mtx-1.3.12/scsi_sgi.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(CMDBUF(dsp), CDB, CDB_Length); data/mtx-1.3.12/scsi_sgi.c:76: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(RequestSense, SENSEBUF(dsp), min(sizeof(RequestSense_T), SENSESENT(dsp))); data/mtx-1.3.12/scsi_sun.c:25: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). int DeviceFD = open(DeviceName, O_RDWR | O_NDELAY); data/mtx-1.3.12/scsi_win32.c:49:2: [2] (buffer) TCHAR: 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. TCHAR szDevicePath[256]; data/mtx-1.3.12/scsi_win32.c:101: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(szDevicePath, "\\\\.\\scsi%d:", port); data/mtx-1.3.12/scsi_win32.c:108: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(szDevicePath, "\\\\.\\", 4 * sizeof(TCHAR)); data/mtx-1.3.12/scsi_win32.c:296: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(ScsiPassThrough->Cdb, CDB, CDB_Length); data/mtx-1.3.12/scsi_win32.c:301: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((void *)(((char *)ScsiPassThrough) + dwDataBufferOffset), DataBuffer, DataBufferLength); data/mtx-1.3.12/scsi_win32.c:321: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(RequestSense, &ScsiPassThrough[1], sizeof(RequestSense_T)); data/mtx-1.3.12/scsi_win32.c:332: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( DataBuffer, data/mtx-1.3.12/scsitape.c:136:9: [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). retval=atoi(arg); data/mtx-1.3.12/scsitape.c:295: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 buffer[6]; data/mtx-1.3.12/scsitape.c:322: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 buffer[6]; data/mtx-1.3.12/scsitape.c:349: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 buffer[6]; data/mtx-1.3.12/scsitape.c:396: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 buffer[6]; data/mtx-1.3.12/scsitape.c:420: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 buffer[6]; data/mtx-1.3.12/scsitape.c:481:2: [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[12]; data/mtx-1.3.12/sg_err.c:25: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 scsi_command_size[8] = { 6, 10, 10, 12, data/mtx-1.3.12/tapeinfo.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 *PeripheralDeviceType[32] = data/mtx-1.3.12/tapeinfo.c:253: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 buffer[TAPEALERT_SIZE]; /* Overkill, but ... */ data/mtx-1.3.12/tapeinfo.c:354: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 buffer[TAPEALERT_SIZE]; data/mtx-1.3.12/tapeinfo.c:732: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. unsigned char buffer[WILD_SER_SIZE]; /* just wildly overestimate serial# length! */ data/mtx-1.3.12/tapeinfo.c:771: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 buffer[6]; data/mtx-1.3.12/tapeinfo.c:796: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 buffer[20]; data/mtx-1.3.12/tapeinfo.c:861: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 buffer[6]; data/mtx-1.3.12/tapeinfo.c:889: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 buffer[6]; data/mtx-1.3.12/vms/scsi.c:333: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 RequestSenseCDB[6] = data/mtx-1.3.12/vms/scsi.c:372:2: [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 SymbolName[32], SymbolValue[32]; data/mtx-1.3.12/vms/scsi.c:378: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(SymbolValue, "FULL:%d", data/mtx-1.3.12/vms/scsi.c:389:2: [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(SymbolValue, "%d", StorageElementCount); data/mtx-1.3.12/vms/scsi.c:395: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(SymbolName, "MTX_STE%02d", StorageElementNumber); data/mtx-1.3.12/mtxl.c:178: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). numchars=strlen(TargetPointer); data/mtx-1.3.12/scsi_linux.c:393:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). result=read(DeviceFD,ResultBuf,Header->reply_len); data/mtx-1.3.12/scsi_win32.c:117:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(&szDevicePath[nPrefixLength], data/mtx-1.3.12/scsitape.c:769:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). result=(int)read(infile, buffer + len, (size_t)(buffersize - len)); data/mtx-1.3.12/vms/ldrset.c:75:25: [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). d_ret->dsc$w_length = strlen((const char *)str); data/mtx-1.3.12/vms/scsi.c:140: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). d_ret->dsc$w_length = strlen((const char *) String); ANALYSIS SUMMARY: Hits = 114 Lines analyzed = 10156 in approximately 0.30 seconds (34224 lines/second) Physical Source Lines of Code (SLOC) = 7108 Hits@level = [0] 316 [1] 6 [2] 94 [3] 10 [4] 4 [5] 0 Hits@level+ = [0+] 430 [1+] 114 [2+] 108 [3+] 14 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 60.4952 [1+] 16.0383 [2+] 15.1941 [3+] 1.96961 [4+] 0.562746 [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.