- Timestamp:
- Jun 29, 2020 4:21:34 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 138891
- Location:
- trunk/src/VBox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibClipboard.cpp
r84733 r84996 817 817 Msg.enmType.SetUInt32(VBOX_SHCL_REPLYMSGTYPE_TRANSFER_STATUS); 818 818 Msg.rc.SetUInt32((uint32_t )rcTransfer); /* int vs. uint32_t */ 819 Msg.cbPayload.SetUInt32(0);820 819 Msg.pvPayload.SetPtr(NULL, 0); 821 820 … … 986 985 Msg.uContext.SetUInt64(pCtx->idContext); 987 986 Msg.fList.SetUInt32(0); 988 Msg.cbFilter.SetUInt32(pOpenParms->cbFilter);989 987 Msg.pvFilter.SetPtr(pOpenParms->pszFilter, pOpenParms->cbFilter); 990 Msg.cbPath.SetUInt32(pOpenParms->cbPath);991 988 Msg.pvPath.SetPtr(pOpenParms->pszPath, pOpenParms->cbPath); 992 989 Msg.uHandle.SetUInt64(0); … … 1022 1019 Msg.uContext.SetUInt64(VBOX_SHCL_HOST_MSG_TRANSFER_LIST_OPEN); 1023 1020 Msg.fList.SetUInt32(0); 1024 Msg.cbPath.SetUInt32(pOpenParms->cbPath);1025 1021 Msg.pvPath.SetPtr(pOpenParms->pszPath, pOpenParms->cbPath); 1026 Msg.cbFilter.SetUInt32(pOpenParms->cbFilter);1027 1022 Msg.pvFilter.SetPtr(pOpenParms->pszFilter, pOpenParms->cbFilter); 1028 1023 Msg.uHandle.SetUInt64(0); … … 1034 1029 if (RT_SUCCESS(rc)) 1035 1030 rc = Msg.fList.GetUInt32(&pOpenParms->fList); 1036 if (RT_SUCCESS(rc))1037 rc = Msg.cbFilter.GetUInt32(&pOpenParms->cbFilter);1038 if (RT_SUCCESS(rc))1039 rc = Msg.cbPath.GetUInt32(&pOpenParms->cbPath);1040 1031 } 1041 1032 … … 1065 1056 Msg.enmType.SetUInt32(VBOX_SHCL_REPLYMSGTYPE_LIST_OPEN); 1066 1057 Msg.rc.SetUInt32((uint32_t)rcReply); /** int vs. uint32_t */ 1067 Msg.cbPayload.SetUInt32(0);1068 1058 Msg.pvPayload.SetPtr(NULL, 0); 1069 1059 … … 1130 1120 Msg.enmType.SetUInt32(VBOX_SHCL_REPLYMSGTYPE_LIST_CLOSE); 1131 1121 Msg.rc.SetUInt32((uint32_t)rcReply); /** int vs. uint32_t */ 1132 Msg.cbPayload.SetUInt32(0);1133 1122 Msg.pvPayload.SetPtr(NULL, 0); 1134 1123 … … 1414 1403 Msg.uContext.SetUInt64(VBOX_SHCL_HOST_MSG_TRANSFER_OBJ_OPEN); 1415 1404 Msg.uHandle.SetUInt64(0); 1416 Msg.cbPath.SetUInt32(pCreateParms->cbPath);1417 1405 Msg.szPath.SetPtr(pCreateParms->pszPath, pCreateParms->cbPath); 1418 1406 Msg.fCreate.SetUInt32(0); … … 1422 1410 { 1423 1411 rc = Msg.uContext.GetUInt64(&pCtx->idContext); 1424 if (RT_SUCCESS(rc))1425 rc = Msg.cbPath.GetUInt32(&pCreateParms->cbPath);1426 1412 if (RT_SUCCESS(rc)) 1427 1413 rc = Msg.fCreate.GetUInt32(&pCreateParms->fCreate); … … 1453 1439 Msg.enmType.SetUInt32(VBOX_SHCL_REPLYMSGTYPE_OBJ_OPEN); 1454 1440 Msg.rc.SetUInt32((uint32_t)rcReply); /** int vs. uint32_t */ 1455 Msg.cbPayload.SetUInt32(0);1456 1441 Msg.pvPayload.SetPtr(NULL, 0); 1457 1442 … … 1487 1472 Msg.uContext.SetUInt64(pCtx->idContext); 1488 1473 Msg.uHandle.SetUInt64(0); 1489 Msg.cbPath.SetUInt32(pCreateParms->cbPath);1490 1474 Msg.szPath.SetPtr((void *)pCreateParms->pszPath, pCreateParms->cbPath); 1491 1475 Msg.fCreate.SetUInt32(pCreateParms->fCreate); … … 1555 1539 Msg.enmType.SetUInt32(VBOX_SHCL_REPLYMSGTYPE_OBJ_CLOSE); 1556 1540 Msg.rc.SetUInt32((uint32_t)rcReply); /** int vs. uint32_t */ 1557 Msg.cbPayload.SetUInt32(0);1558 1541 Msg.pvPayload.SetPtr(NULL, 0); 1559 1542 … … 1710 1693 Msg.uHandle.SetUInt64(hObj); 1711 1694 Msg.pvData.SetPtr(pvData, cbData); 1712 Msg.cbData.SetUInt32(cbData);1713 1695 Msg.pvChecksum.SetPtr(NULL, 0); 1714 Msg.cbChecksum.SetUInt32(0);1715 1696 1716 1697 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-transfers.cpp
r84142 r84996 791 791 if (cParms >= VBOX_SHCL_CPARMS_REPLY_MIN) 792 792 { 793 uint32_t cbPayload = 0;794 795 793 /* aParms[0] has the context ID. */ 796 794 rc = HGCMSvcGetU32(&aParms[1], &pReply->uType); … … 798 796 rc = HGCMSvcGetU32(&aParms[2], &pReply->rc); 799 797 if (RT_SUCCESS(rc)) 800 rc = HGCMSvcGetU32(&aParms[3], &cbPayload); 801 if (RT_SUCCESS(rc)) 802 { 803 rc = HGCMSvcGetPv(&aParms[4], &pReply->pvPayload, &pReply->cbPayload); 804 AssertReturn(cbPayload == pReply->cbPayload, VERR_INVALID_PARAMETER); 805 } 798 rc = HGCMSvcGetPv(&aParms[3], &pReply->pvPayload, &pReply->cbPayload); 806 799 807 800 if (RT_SUCCESS(rc)) … … 809 802 rc = VERR_INVALID_PARAMETER; /* Play safe. */ 810 803 804 const unsigned idxParm = VBOX_SHCL_CPARMS_REPLY_MIN; 805 811 806 switch (pReply->uType) 812 807 { 813 808 case VBOX_SHCL_REPLYMSGTYPE_TRANSFER_STATUS: 814 809 { 815 if (cParms > = 6)816 rc = HGCMSvcGetU32(&aParms[ 5], &pReply->u.TransferStatus.uStatus);810 if (cParms > idxParm) 811 rc = HGCMSvcGetU32(&aParms[idxParm], &pReply->u.TransferStatus.uStatus); 817 812 818 813 LogFlowFunc(("uTransferStatus=%RU32\n", pReply->u.TransferStatus.uStatus)); … … 822 817 case VBOX_SHCL_REPLYMSGTYPE_LIST_OPEN: 823 818 { 824 if (cParms > = 6)825 rc = HGCMSvcGetU64(&aParms[ 5], &pReply->u.ListOpen.uHandle);819 if (cParms > idxParm) 820 rc = HGCMSvcGetU64(&aParms[idxParm], &pReply->u.ListOpen.uHandle); 826 821 827 822 LogFlowFunc(("hListOpen=%RU64\n", pReply->u.ListOpen.uHandle)); … … 831 826 case VBOX_SHCL_REPLYMSGTYPE_LIST_CLOSE: 832 827 { 833 if (cParms > = 6)834 rc = HGCMSvcGetU64(&aParms[ 5], &pReply->u.ListClose.uHandle);828 if (cParms > idxParm) 829 rc = HGCMSvcGetU64(&aParms[idxParm], &pReply->u.ListClose.uHandle); 835 830 836 831 LogFlowFunc(("hListClose=%RU64\n", pReply->u.ListClose.uHandle)); … … 840 835 case VBOX_SHCL_REPLYMSGTYPE_OBJ_OPEN: 841 836 { 842 if (cParms > = 6)843 rc = HGCMSvcGetU64(&aParms[ 5], &pReply->u.ObjOpen.uHandle);837 if (cParms > idxParm) 838 rc = HGCMSvcGetU64(&aParms[idxParm], &pReply->u.ObjOpen.uHandle); 844 839 845 840 LogFlowFunc(("hObjOpen=%RU64\n", pReply->u.ObjOpen.uHandle)); … … 849 844 case VBOX_SHCL_REPLYMSGTYPE_OBJ_CLOSE: 850 845 { 851 if (cParms > = 6)852 rc = HGCMSvcGetU64(&aParms[ 5], &pReply->u.ObjClose.uHandle);846 if (cParms > idxParm) 847 rc = HGCMSvcGetU64(&aParms[idxParm], &pReply->u.ObjClose.uHandle); 853 848 854 849 LogFlowFunc(("hObjClose=%RU64\n", pReply->u.ObjClose.uHandle)); … … 947 942 if (cParms == VBOX_SHCL_CPARMS_LIST_OPEN) 948 943 { 949 uint32_t cbPath = 0;950 uint32_t cbFilter = 0;951 952 944 rc = HGCMSvcGetU32(&aParms[1], &pOpenParms->fList); 953 945 if (RT_SUCCESS(rc)) 954 rc = HGCMSvcGetU32(&aParms[2], &cbFilter); 955 if (RT_SUCCESS(rc)) 956 { 957 rc = HGCMSvcGetStr(&aParms[3], &pOpenParms->pszFilter, &pOpenParms->cbFilter); 958 AssertReturn(cbFilter == pOpenParms->cbFilter, VERR_INVALID_PARAMETER); 959 } 960 if (RT_SUCCESS(rc)) 961 rc = HGCMSvcGetU32(&aParms[4], &cbPath); 962 if (RT_SUCCESS(rc)) 963 { 964 rc = HGCMSvcGetStr(&aParms[5], &pOpenParms->pszPath, &pOpenParms->cbPath); 965 AssertReturn(cbPath == pOpenParms->cbPath, VERR_INVALID_PARAMETER); 966 } 946 rc = HGCMSvcGetStr(&aParms[2], &pOpenParms->pszFilter, &pOpenParms->cbFilter); 947 if (RT_SUCCESS(rc)) 948 rc = HGCMSvcGetStr(&aParms[3], &pOpenParms->pszPath, &pOpenParms->cbPath); 967 949 968 950 /** @todo Some more validation. */ … … 993 975 HGCMSvcSetU64(&aParms[0], idCtx); 994 976 HGCMSvcSetU32(&aParms[1], pOpenParms->fList); 995 HGCMSvcSetU32(&aParms[2], pOpenParms->cbFilter); 996 HGCMSvcSetPv (&aParms[3], pOpenParms->pszFilter, pOpenParms->cbFilter); 997 HGCMSvcSetU32(&aParms[4], pOpenParms->cbPath); 998 HGCMSvcSetPv (&aParms[5], pOpenParms->pszPath, pOpenParms->cbPath); 999 HGCMSvcSetU64(&aParms[6], 0); /* OUT: uHandle */ 977 HGCMSvcSetPv (&aParms[2], pOpenParms->pszFilter, pOpenParms->cbFilter); 978 HGCMSvcSetPv (&aParms[3], pOpenParms->pszPath, pOpenParms->cbPath); 979 HGCMSvcSetU64(&aParms[4], 0); /* OUT: uHandle */ 1000 980 1001 981 rc = VINF_SUCCESS; … … 1623 1603 RT_ZERO(openCreateParms); 1624 1604 1625 uint32_t cbPath; 1626 rc = HGCMSvcGetU32(&aParms[2], &cbPath); /** @todo r=bird: This is an pointless parameter. */ 1627 if (RT_SUCCESS(rc)) 1628 { 1629 /** @todo r=bird: This is the wrong way of getting a string! */ 1630 rc = HGCMSvcGetPv(&aParms[3], (void **)&openCreateParms.pszPath, &openCreateParms.cbPath); 1631 if (cbPath != openCreateParms.cbPath) 1632 rc = VERR_INVALID_PARAMETER; 1633 } 1634 if (RT_SUCCESS(rc)) 1635 rc = HGCMSvcGetU32(&aParms[4], &openCreateParms.fCreate); 1605 /* aParms[1] will return the object handle on success; see below. */ 1606 rc = HGCMSvcGetStr(&aParms[2], &openCreateParms.pszPath, &openCreateParms.cbPath); 1607 if (RT_SUCCESS(rc)) 1608 rc = HGCMSvcGetU32(&aParms[3], &openCreateParms.fCreate); 1636 1609 1637 1610 if (RT_SUCCESS(rc))
Note:
See TracChangeset
for help on using the changeset viewer.