File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -390,10 +390,15 @@ void oz_usb_rx(struct oz_pd *pd, struct oz_elt *elt)
390
390
case OZ_GET_DESC_RSP : {
391
391
struct oz_get_desc_rsp * body =
392
392
(struct oz_get_desc_rsp * )usb_hdr ;
393
- int data_len = elt -> length -
394
- sizeof (struct oz_get_desc_rsp ) + 1 ;
395
- u16 offs = le16_to_cpu (get_unaligned (& body -> offset ));
396
- u16 total_size =
393
+ u16 offs , total_size ;
394
+ u8 data_len ;
395
+
396
+ if (elt -> length < sizeof (struct oz_get_desc_rsp ) - 1 )
397
+ break ;
398
+ data_len = elt -> length -
399
+ (sizeof (struct oz_get_desc_rsp ) - 1 );
400
+ offs = le16_to_cpu (get_unaligned (& body -> offset ));
401
+ total_size =
397
402
le16_to_cpu (get_unaligned (& body -> total_size ));
398
403
oz_dbg (ON , "USB_REQ_GET_DESCRIPTOR - cnf\n" );
399
404
oz_hcd_get_desc_cnf (usb_ctx -> hport , body -> req_id ,
You can’t perform that action at this time.
0 commit comments