VirtualBox

Changeset 95335 in vbox for trunk/src/VBox/HostServices


Ignore:
Timestamp:
Jun 21, 2022 7:55:01 PM (3 years ago)
Author:
vboxsync
Message:

GuestProperties: Must validate the encoding of all additional pattern strings in enumProps, as HGCMSvcGetCStr stops at the first string terminator. bugref:10185

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/GuestProperties/VBoxGuestPropSvc.cpp

    r95332 r95335  
    5858#include <VBox/vmm/dbgf.h>
    5959#include <VBox/version.h>
     60#include <VBox/AssertGuest.h>
    6061
    6162#include <list>
     
    960961    {
    961962        for (unsigned i = 0; i < cbPatterns - 1; ++i)
     963        {
     964            char ch = pchPatterns[i];
    962965            if (pchPatterns[i] != '\0')
    963                 szPatterns[i] = pchPatterns[i];
     966            { /* likely*/ }
    964967            else
    965                 szPatterns[i] = '|';
     968            {
     969                /* Since the RTStrValidateEncodingEx call in HGCMSvcGetCStr stops at the
     970                   first terminator, we have to validate all subsequent pattern strings. */
     971                rc = RTStrValidateEncodingEx(&pchPatterns[i + 1], cbPatterns - i -1, RTSTR_VALIDATE_ENCODING_ZERO_TERMINATED);
     972                ASSERT_GUEST_RC_BREAK(rc);
     973                ch = '|';
     974            }
     975            szPatterns[i] = ch;
     976        }
    966977        szPatterns[cbPatterns - 1] = '\0';
    967978    }
Note: See TracChangeset for help on using the changeset viewer.

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