--- a/sys/dev/disk/trm/trm.c +++ b/sys/dev/disk/trm/trm.c @@ -2527,7 +2527,7 @@ pSRB->pSRBSGL->length = pSRB->SgSenseTemp.length; pcsio->scsi_status = SCSI_STATUS_CHECK_COND; bcopy(trm_get_sense_buf(pACB, pSRB), &pcsio->sense_data, - pcsio->sense_len); + imin(pcsio->sense_len, sizeof(pcsio->sense_data))); pcsio->ccb_h.status = CAM_SCSI_STATUS_ERROR | CAM_AUTOSNS_VALID; goto ckc_e;