Changeset 95325 in vbox for trunk/src/VBox/Main/xml
- Timestamp:
- Jun 21, 2022 2:18:21 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/xml/Settings.cpp
r95229 r95325 4647 4647 { 4648 4648 GuestProperty prop; 4649 int rc;4650 4649 4651 4650 pelmProp->getAttributeValue("name", prop.strName); … … 4658 4657 * placing it to local cache. */ 4659 4658 4660 rc = GuestPropValidateName(prop.strName.c_str(), (uint32_t)prop.strName.length() + 1 /* '\0' */);4659 int rc = GuestPropValidateName(prop.strName.c_str(), (uint32_t)prop.strName.length() + 1 /* '\0' */); 4661 4660 if (RT_FAILURE(rc)) 4662 4661 { … … 4673 4672 4674 4673 /* 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 } 4674 * should be less than GUEST_PROP_MAX_VALUE_LEN. Chop it down to an appropriate length. */ 4675 /** @todo r=bird: Should add a RTCString method for this, as this may create a 4676 * invalid UTF-8 encoding if we chop up a UTF-8 sequence. */ 4677 Assert(prop.strValue.length() + 1 >= GUEST_PROP_MAX_VALUE_LEN); 4678 prop.strValue.mutableRaw()[GUEST_PROP_MAX_VALUE_LEN - 2] = '\0'; 4679 prop.strValue.jolt(); 4688 4680 } 4689 4681 else if (RT_FAILURE(rc))
Note:
See TracChangeset
for help on using the changeset viewer.