Skip to content

Commit afe2e39

Browse files
committed
fix(security): fix video control memcpy size with sizeof(struct video_probe_and_commit_controls)
Signed-off-by: sakumisu <1203593632@qq.com>
1 parent 5e9d0e6 commit afe2e39

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

class/video/usbd_video.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -561,18 +561,18 @@ static int usbd_video_stream_request_handler(uint8_t busid, struct usb_setup_pac
561561
case VIDEO_VS_PROBE_CONTROL:
562562
switch (setup->bRequest) {
563563
case VIDEO_REQUEST_SET_CUR:
564-
//memcpy((uint8_t *)&g_usbd_video[busid].probe, *data, setup->wLength);
564+
//memcpy((uint8_t *)&g_usbd_video[busid].probe, *data, sizeof(struct video_probe_and_commit_controls));
565565
break;
566566
case VIDEO_REQUEST_GET_CUR:
567-
memcpy(*data, (uint8_t *)&g_usbd_video[busid].probe, setup->wLength);
567+
memcpy(*data, (uint8_t *)&g_usbd_video[busid].probe, sizeof(struct video_probe_and_commit_controls));
568568
*len = sizeof(struct video_probe_and_commit_controls);
569569
break;
570570

571571
case VIDEO_REQUEST_GET_MIN:
572572
case VIDEO_REQUEST_GET_MAX:
573573
case VIDEO_REQUEST_GET_RES:
574574
case VIDEO_REQUEST_GET_DEF:
575-
memcpy(*data, (uint8_t *)&g_usbd_video[busid].probe, setup->wLength);
575+
memcpy(*data, (uint8_t *)&g_usbd_video[busid].probe, sizeof(struct video_probe_and_commit_controls));
576576
*len = sizeof(struct video_probe_and_commit_controls);
577577
break;
578578
case VIDEO_REQUEST_GET_LEN:
@@ -592,17 +592,17 @@ static int usbd_video_stream_request_handler(uint8_t busid, struct usb_setup_pac
592592
case VIDEO_VS_COMMIT_CONTROL:
593593
switch (setup->bRequest) {
594594
case VIDEO_REQUEST_SET_CUR:
595-
//memcpy((uint8_t *)&g_usbd_video[busid].commit, *data, setup->wLength);
595+
//memcpy((uint8_t *)&g_usbd_video[busid].commit, *data, sizeof(struct video_probe_and_commit_controls));
596596
break;
597597
case VIDEO_REQUEST_GET_CUR:
598-
memcpy(*data, (uint8_t *)&g_usbd_video[busid].commit, setup->wLength);
598+
memcpy(*data, (uint8_t *)&g_usbd_video[busid].commit, sizeof(struct video_probe_and_commit_controls));
599599
*len = sizeof(struct video_probe_and_commit_controls);
600600
break;
601601
case VIDEO_REQUEST_GET_MIN:
602602
case VIDEO_REQUEST_GET_MAX:
603603
case VIDEO_REQUEST_GET_RES:
604604
case VIDEO_REQUEST_GET_DEF:
605-
memcpy(*data, (uint8_t *)&g_usbd_video[busid].commit, setup->wLength);
605+
memcpy(*data, (uint8_t *)&g_usbd_video[busid].commit, sizeof(struct video_probe_and_commit_controls));
606606
*len = sizeof(struct video_probe_and_commit_controls);
607607
break;
608608

0 commit comments

Comments
 (0)