DF-1348 / fix.diff
diff --git a/sys/dev/disk/amd/amd.c b/sys/dev/disk/amd/amd.c --- a/sys/dev/disk/amd/amd.c +++ b/sys/dev/disk/amd/amd.c @@ -396,8 +396,8 @@ pSRB->pccb = pccb; pccb->ccb_h.ccb_srb_ptr = pSRB; pccb->ccb_h.ccb_amd_ptr = amd; - pSRB->ScsiCmdLen = pcsio->cdb_len; - bcopy(pcsio->cdb_io.cdb_bytes, pSRB->CmdBlock, pcsio->cdb_len); + pSRB->ScsiCmdLen = imin(pcsio->cdb_len, (int)sizeof(pSRB->CmdBlock)); + bcopy(pcsio->cdb_io.cdb_bytes, pSRB->CmdBlock, pSRB->ScsiCmdLen); if ((pccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) { if ((pccb->ccb_h.flags & CAM_SCATTER_VALID) == 0) { /* |