VirtualBox

Changeset 95337 in vbox


Ignore:
Timestamp:
Jun 21, 2022 8:50:20 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
151929
Message:

Main/Settings.cpp: Use RTCString::trucate to reduce guest property values to a length of GUEST_PROP_MAX_VALUE_LEN-1. bugref:10185

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/xml/Settings.cpp

    r95334 r95337  
    46734673            /* In order to pass validation, guest property value length (including '\0') in bytes
    46744674             * 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 - 1] = '\0';
    4679             prop.strValue.jolt();
     4675            prop.strValue.truncate(GUEST_PROP_MAX_VALUE_LEN - 1 /*terminator*/);
    46804676        }
    46814677        else if (RT_FAILURE(rc))
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette