- Timestamp:
- Jun 21, 2022 2:09:10 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/GuestProperties/VBoxGuestPropSvc.cpp
r94184 r95324 659 659 int Service::setProperty(uint32_t cParms, VBOXHGCMSVCPARM paParms[], bool isGuest) 660 660 { 661 int rc = VINF_SUCCESS;662 661 const char *pcszName = NULL; /* shut up gcc */ 663 662 const char *pcszValue = NULL; /* ditto */ 664 663 const char *pcszFlags = NULL; 665 uint32_t c chName = 0;/* ditto */666 uint32_t c chValue = 0;/* ditto */667 uint32_t c chFlags = 0;664 uint32_t cbName = 0; /* ditto */ 665 uint32_t cbValue = 0; /* ditto */ 666 uint32_t cbFlags = 0; 668 667 uint32_t fFlags = GUEST_PROP_F_NILFLAG; 669 668 uint64_t u64TimeNano = getCurrentTimestamp(); … … 674 673 * General parameter correctness checking. 675 674 */ 676 i f ( RT_SUCCESS(rc)677 && ( (cParms < 2) || (cParms > 3) /* Hardcoded value as the next lines depend on it. */678 || RT_FAILURE(HGCMSvcGetCStr(&paParms[0], &pcszName, &cchName)) /* name */679 || RT_FAILURE(HGCMSvcGetCStr(&paParms[1], &pcszValue, &cchValue)) /* value */680 || ( (3 == cParms)681 && RT_FAILURE(HGCMSvcGetCStr(&paParms[2], &pcszFlags, &cchFlags)) /* flags */682 )675 int rc = VINF_SUCCESS; 676 if ( cParms < 2 /* Hardcoded value as the next lines depend on it these range checks. */ 677 || cParms > 3 678 || RT_FAILURE(HGCMSvcGetCStr(&paParms[0], &pcszName, &cbName)) /* name */ 679 || RT_FAILURE(HGCMSvcGetCStr(&paParms[1], &pcszValue, &cbValue)) /* value */ 680 || ( cParms == 3 681 && RT_FAILURE(HGCMSvcGetCStr(&paParms[2], &pcszFlags, &cbFlags)) /* flags */ 683 682 ) 684 683 ) … … 689 688 */ 690 689 if (RT_SUCCESS(rc)) 691 rc = GuestPropValidateName(pcszName, c chName);690 rc = GuestPropValidateName(pcszName, cbName); 692 691 if (RT_SUCCESS(rc)) 693 rc = GuestPropValidateValue(pcszValue, cchValue); 694 if ((3 == cParms) && RT_SUCCESS(rc)) 695 rc = RTStrValidateEncodingEx(pcszFlags, cchFlags, 696 RTSTR_VALIDATE_ENCODING_ZERO_TERMINATED); 697 if ((3 == cParms) && RT_SUCCESS(rc)) 692 rc = GuestPropValidateValue(pcszValue, cbValue); 693 if (cParms == 3 && RT_SUCCESS(rc)) 698 694 rc = GuestPropValidateFlags(pcszFlags, &fFlags); 699 695 if (RT_FAILURE(rc))
Note:
See TracChangeset
for help on using the changeset viewer.