VirtualBox

Changeset 92663 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Dec 1, 2021 2:55:35 AM (3 years ago)
Author:
vboxsync
Message:

VBoxService: Restrict the argv[0] quoting hack to windows in vgsvcGstCtrlProcessAllocateArgv.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlProcess.cpp

    r92662 r92663  
    10491049    AssertPtrReturn(pszArgv0,   VERR_INVALID_POINTER);
    10501050    AssertPtrReturn(ppapszArgv, VERR_INVALID_POINTER);
     1051    AssertReturn(!(fFlags & EXECUTEPROCESSFLAG_EXPAND_ARGUMENTS), VERR_INVALID_FLAGS); /** @todo implement me */
    10511052
    10521053#ifndef VBOXSERVICE_ARG1_UTF8_ARGV
     
    10781079#endif
    10791080
    1080     /* HACK ALERT! Older hosts (< VBox 6.1.x) did not allow the user to really specify the first
    1081                    argument separately from the executable image, so we have to fudge
    1082                    a little in the unquoted argument case to deal with executables
    1083                    containing spaces. */
    1084     /** @todo r=bird: WTF!?? This makes absolutely no sense on non-windows.  An
    1085      * on windows the first flag test must be inverted, as it's when RTProcCreateEx
    1086      * doesn't do any quoting that we have to do it here, isn't it?
    1087      * Aaaaaaaaaaaaaaaaaaarrrrrrrrrrrrrrrrrrrrrrrrrrgggggggggggggggggggggggg! */
    1088     if (   !(fFlags & EXECUTEPROCESSFLAG_UNQUOTED_ARGS)
    1089         || !strpbrk(pszArgv0, " \t\n\r")
    1090         || pszArgv0[0] == '"')
    1091     {
    1092         rc = RTStrDupEx(&papszNewArgv[0], pszArgv0);
    1093     }
    1094     else
     1081    /* HACK ALERT! Older hosts (< VBox 6.1.x) did not allow the user to really specify
     1082                   the first argument separately from the executable image, so we have
     1083                   to fudge a little in the unquoted argument case to deal with executables
     1084                   containing spaces.  Windows only, as RTPROC_FLAGS_UNQUOTED_ARGS is
     1085                   ignored on all other hosts. */
     1086#ifdef RT_OS_WINDOWS
     1087    if (   (fFlags & EXECUTEPROCESSFLAG_UNQUOTED_ARGS)
     1088        && strpbrk(pszArgv0, " \t\n\r")
     1089        && pszArgv0[0] == '"')
    10951090    {
    10961091        size_t cchArgv0 = strlen(pszArgv0);
     
    11071102        }
    11081103    }
    1109 
     1104    else
     1105#endif
     1106        rc = RTStrDupEx(&papszNewArgv[0], pszArgv0);
    11101107    if (RT_SUCCESS(rc))
    11111108    {
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