Changeset 95229 in vbox for trunk/src/VBox/Main/xml
- Timestamp:
- Jun 8, 2022 1:10:39 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/xml/Settings.cpp
r94981 r95229 83 83 #include <iprt/stream.h> 84 84 #include <iprt/uri.h> 85 86 // Guest Properties validation. 87 #include "VBox/HostServices/GuestPropertySvc.h" 85 88 86 89 // generated header … … 4644 4647 { 4645 4648 GuestProperty prop; 4649 int rc; 4650 4646 4651 pelmProp->getAttributeValue("name", prop.strName); 4647 4652 pelmProp->getAttributeValue("value", prop.strValue); … … 4649 4654 pelmProp->getAttributeValue("timestamp", prop.timestamp); 4650 4655 pelmProp->getAttributeValue("flags", prop.strFlags); 4656 4657 /* Check guest property 'name' and 'value' for correctness before 4658 * placing it to local cache. */ 4659 4660 rc = GuestPropValidateName(prop.strName.c_str(), (uint32_t)prop.strName.length() + 1 /* '\0' */); 4661 if (RT_FAILURE(rc)) 4662 { 4663 LogRel(("WARNING: Guest property with invalid name (%s) present in VM configuration file. Guest property will be dropped.\n", 4664 prop.strName.c_str())); 4665 continue; 4666 } 4667 4668 rc = GuestPropValidateValue(prop.strValue.c_str(), (uint32_t)prop.strValue.length() + 1 /* '\0' */); 4669 if (rc == VERR_TOO_MUCH_DATA) 4670 { 4671 LogRel(("WARNING: Guest property '%s' present in VM configuration file and has too long value. Guest property value will be truncated.\n", 4672 prop.strName.c_str())); 4673 4674 /* In order to pass validation, guest property value length (including '\0') in bytes 4675 * should be less than GUEST_PROP_MAX_VALUE_LEN. Reallocate it to corresponding size. */ 4676 rc = prop.strValue.reserveNoThrow(GUEST_PROP_MAX_VALUE_LEN - 1); 4677 if (RT_SUCCESS(rc)) 4678 { 4679 prop.strValue.mutableRaw()[GUEST_PROP_MAX_VALUE_LEN - 2] = '\0'; 4680 prop.strValue.jolt(); 4681 } 4682 else 4683 { 4684 LogRel(("WARNING: Unable to truncate guest property '%s' valuem rc=%Rrc. Guest property value will be skipped.\n", 4685 prop.strName.c_str(), rc)); 4686 continue; 4687 } 4688 } 4689 else if (RT_FAILURE(rc)) 4690 { 4691 LogRel(("WARNING: Guest property '%s' present in VM configuration file and has invalid value. Guest property will be dropped.\n", 4692 prop.strName.c_str())); 4693 continue; 4694 } 4695 4651 4696 hw.llGuestProperties.push_back(prop); 4652 4697 }
Note:
See TracChangeset
for help on using the changeset viewer.