DragonFlyBSD Kernel Audit
DF-1001 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/bus/u4b/storage/umass.c b/sys/bus/u4b/storage/umass.c
--- a/sys/bus/u4b/storage/umass.c
+++ b/sys/bus/u4b/storage/umass.c
@@ -2324,6 +2324,8 @@
 						struct scsi_vpd_unit_serial_number *vpd_serial;
 
 						vpd_serial = (struct scsi_vpd_unit_serial_number *)ccb->csio.data_ptr;
+						if (ccb->csio.dxfer_len < sizeof(struct scsi_vpd_unit_serial_number))
+							break;
 						vpd_serial->length = strlen(pserial);
 						if (vpd_serial->length > sizeof(vpd_serial->serial_num))
 							vpd_serial->length = sizeof(vpd_serial->serial_num);