Changeset 85145 in vbox for trunk/src/VBox/HostServices
- Timestamp:
- Jul 9, 2020 9:59:22 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/DragAndDrop/VBoxDragAndDropSvc.cpp
r85121 r85145 30 30 #include <VBox/HostServices/Service.h> 31 31 #include <VBox/HostServices/DragAndDropSvc.h> 32 #include <VBox/AssertGuest.h> 32 33 33 34 #include <VBox/err.h> … … 408 409 } 409 410 411 /* Verifies that an uint32 parameter has the expected buffer size set. 412 * Will set rc to VERR_INVALID_PARAMETER otherwise. See #9777. */ 413 #define VERIFY_BUFFER_SIZE_UINT32(a_ParmUInt32, a_SizeExpected) \ 414 { \ 415 uint32_t cbTemp = 0; \ 416 rc = HGCMSvcGetU32(&a_ParmUInt32, &cbTemp); \ 417 ASSERT_GUEST_STMT(RT_SUCCESS(rc) && cbTemp == a_SizeExpected, rc = VERR_INVALID_PARAMETER); \ 418 } 419 410 420 if (rc == VINF_SUCCESS) /* Note: rc might be VINF_HGCM_ASYNC_EXECUTE! */ 411 421 { … … 557 567 if (RT_SUCCESS(rc)) 558 568 rc = HGCMSvcGetPv(&paParms[1], (void **)&data.pszFormat, &data.cbFormat); 559 if (RT_SUCCESS(rc)) 560 rc = HGCMSvcGetU32(&paParms[2], &data.cbFormat); 569 VERIFY_BUFFER_SIZE_UINT32(paParms[2], data.cbFormat); 561 570 } 562 571 break; … … 640 649 if (RT_SUCCESS(rc)) 641 650 rc = HGCMSvcGetPv(&paParms[3], (void**)&data.pszFormat, &data.cbFormat); 642 if (RT_SUCCESS(rc)) 643 rc = HGCMSvcGetU32(&paParms[4], &data.cbFormat); 651 VERIFY_BUFFER_SIZE_UINT32(paParms[4], data.cbFormat); 644 652 } 645 653 break; … … 684 692 if (RT_SUCCESS(rc)) 685 693 rc = HGCMSvcGetPv(&paParms[5], &data.data.pvMetaFmt, &data.data.cbMetaFmt); 686 if (RT_SUCCESS(rc)) 687 rc = HGCMSvcGetU32(&paParms[6], &data.data.cbMetaFmt); 694 VERIFY_BUFFER_SIZE_UINT32(paParms[6], data.data.cbMetaFmt); 688 695 if (RT_SUCCESS(rc)) 689 696 rc = HGCMSvcGetU64(&paParms[7], &data.data.cObjects); … … 694 701 if (RT_SUCCESS(rc)) 695 702 rc = HGCMSvcGetPv(&paParms[10], &data.data.pvChecksum, &data.data.cbChecksum); 696 if (RT_SUCCESS(rc)) 697 rc = HGCMSvcGetU32(&paParms[11], &data.data.cbChecksum); 698 703 VERIFY_BUFFER_SIZE_UINT32(paParms[11], data.data.cbChecksum); 699 704 LogFlowFunc(("fFlags=0x%x, cbTotalSize=%RU64, cObj=%RU64\n", 700 705 data.data.uFlags, data.data.cbTotal, data.data.cObjects)); … … 718 723 if (RT_SUCCESS(rc)) 719 724 rc = HGCMSvcGetPv(&paParms[1], (void**)&data.data.u.v3.pvData, &data.data.u.v3.cbData); 720 if (RT_SUCCESS(rc)) 721 rc = HGCMSvcGetU32(&paParms[2], &data.data.u.v3.cbData); 725 VERIFY_BUFFER_SIZE_UINT32(paParms[2], data.data.u.v3.cbData); 722 726 if (RT_SUCCESS(rc)) 723 727 rc = HGCMSvcGetPv(&paParms[3], (void**)&data.data.u.v3.pvChecksum, &data.data.u.v3.cbChecksum); 724 if (RT_SUCCESS(rc)) 725 rc = HGCMSvcGetU32(&paParms[4], &data.data.u.v3.cbChecksum); 728 VERIFY_BUFFER_SIZE_UINT32(paParms[4], data.data.u.v3.cbChecksum); 726 729 DO_HOST_CALLBACK(); 727 730 } … … 764 767 if (RT_SUCCESS(rc)) 765 768 rc = HGCMSvcGetPv(&paParms[1], (void**)&data.pszPath, &data.cbPath); 766 if (RT_SUCCESS(rc)) 767 rc = HGCMSvcGetU32(&paParms[2], &data.cbPath); 769 VERIFY_BUFFER_SIZE_UINT32(paParms[2], data.cbPath); 768 770 if (RT_SUCCESS(rc)) 769 771 rc = HGCMSvcGetU32(&paParms[3], &data.fMode); … … 778 780 { 779 781 rc = HGCMSvcGetPv(&paParms[0], (void**)&data.pszPath, &data.cbPath); 780 if (RT_SUCCESS(rc)) 781 rc = HGCMSvcGetU32(&paParms[1], &data.cbPath); 782 VERIFY_BUFFER_SIZE_UINT32(paParms[1], data.cbPath); 782 783 if (RT_SUCCESS(rc)) 783 784 rc = HGCMSvcGetU32(&paParms[2], &data.fMode); … … 803 804 if (RT_SUCCESS(rc)) 804 805 rc = HGCMSvcGetPv(&paParms[1], (void**)&data.pszFilePath, &data.cbFilePath); 805 if (RT_SUCCESS(rc)) 806 rc = HGCMSvcGetU32(&paParms[2], &data.cbFilePath); 806 VERIFY_BUFFER_SIZE_UINT32(paParms[2], data.cbFilePath); 807 807 if (RT_SUCCESS(rc)) 808 808 rc = HGCMSvcGetU32(&paParms[3], &data.fFlags); … … 836 836 if (RT_SUCCESS(rc)) 837 837 rc = HGCMSvcGetPv(&paParms[1], (void**)&data.pvData, &data.cbData); 838 if (RT_SUCCESS(rc)) 839 rc = HGCMSvcGetU32(&paParms[2], &data.cbData); 838 VERIFY_BUFFER_SIZE_UINT32(paParms[2], data.cbData); 840 839 if (RT_SUCCESS(rc)) 841 840 rc = HGCMSvcGetPv(&paParms[3], (void**)&data.u.v3.pvChecksum, &data.u.v3.cbChecksum); 842 if (RT_SUCCESS(rc)) 843 rc = HGCMSvcGetU32(&paParms[4], &data.u.v3.cbChecksum); 841 VERIFY_BUFFER_SIZE_UINT32(paParms[4], data.u.v3.cbChecksum); 844 842 845 843 LogFlowFunc(("pvData=0x%p, cbData=%RU32\n", data.pvData, data.cbData)); … … 859 857 if (RT_SUCCESS(rc)) 860 858 rc = HGCMSvcGetPv(&paParms[1], (void**)&data.pvData, &data.cbData); 861 if (RT_SUCCESS(rc)) 862 rc = HGCMSvcGetU32(&paParms[2], &data.cbData); 859 VERIFY_BUFFER_SIZE_UINT32(paParms[2], data.cbData); 863 860 864 861 LogFlowFunc(("cbData=%RU32, pvData=0x%p\n", data.cbData, data.pvData)); … … 875 872 RT_ZERO(data); 876 873 data.hdr.uMagic = CB_MAGIC_DND_GH_SND_FILE_DATA; 877 uint32_t cTmp; 878 rc = HGCMSvcGetPv(&paParms[0], (void**)&data.u.v1.pszFilePath, &cTmp); 879 if (RT_SUCCESS(rc)) 880 rc = HGCMSvcGetU32(&paParms[1], &data.u.v1.cbFilePath); 881 if (RT_SUCCESS(rc)) 882 rc = HGCMSvcGetPv(&paParms[2], (void**)&data.pvData, &cTmp); 883 if (RT_SUCCESS(rc)) 884 rc = HGCMSvcGetU32(&paParms[3], &data.cbData); 874 rc = HGCMSvcGetPv(&paParms[0], (void**)&data.u.v1.pszFilePath, &data.u.v1.cbFilePath); 875 VERIFY_BUFFER_SIZE_UINT32(paParms[1], data.u.v1.cbFilePath); 876 if (RT_SUCCESS(rc)) 877 rc = HGCMSvcGetPv(&paParms[2], (void**)&data.pvData, &data.cbData); 878 VERIFY_BUFFER_SIZE_UINT32(paParms[3], data.cbData); 885 879 if (RT_SUCCESS(rc)) 886 880 rc = HGCMSvcGetU32(&paParms[4], &data.u.v1.fMode); … … 982 976 } 983 977 } 978 979 #undef VERIFY_BUFFER_SIZE_UINT32 984 980 985 981 /*
Note:
See TracChangeset
for help on using the changeset viewer.