VirtualBox

Changeset 103431 in vbox


Ignore:
Timestamp:
Feb 19, 2024 12:06:37 PM (9 months ago)
Author:
vboxsync
Message:

tstIntNet-1: RTStrCat won't fail because we already subtracted the size of the string-to-append from the buffer size in the RTPathExecDir call. Just use memcpy to avoid upsetting anyone. bugref:3409

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/testcase/tstIntNet-1.cpp

    r103285 r103431  
    839839    }
    840840
    841     char szPath[RTPATH_MAX];
    842     rc = RTPathExecDir(szPath, sizeof(szPath) - sizeof("/../VMMR0.r0"));
     841    static const char s_szVmmR0[] = "/../VMMR0.r0";
     842    char              szPath[RTPATH_MAX];
     843    rc = RTPathExecDir(szPath, sizeof(szPath) - sizeof(s_szVmmR0));
    843844    if (RT_FAILURE(rc))
    844845    {
     
    846847        return 1;
    847848    }
    848 
    849     rc = RTStrCat(szPath, sizeof(szPath), "/../VMMR0.r0");
    850     if (RT_FAILURE(rc))
    851     {
    852         RTPrintf("tstIntNet-1: RTStrCat -> %Rrc\n", rc);
    853         return 1;
    854     }
     849    memcpy(strchr(szPath, '\0'), s_szVmmR0, sizeof(s_szVmmR0));
    855850
    856851    char szAbsPath[RTPATH_MAX];
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