VirtualBox

Changeset 103440 in vbox


Ignore:
Timestamp:
Feb 19, 2024 1:45:28 PM (9 months ago)
Author:
vboxsync
Message:

IPRT/tstRTR0CommonDriver.h: Buffer overflow for szSrvReqHandler is not possible, so simplified the code accordingly. bugref:3409

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/testcase/tstRTR0CommonDriver.h

    r103285 r103440  
    128128    }
    129129
    130     char szSrvReqHandler[sizeof(g_szSrvName) + sizeof("SrvReqHandler")];
    131     rc = RTStrCopy(szSrvReqHandler, sizeof(szSrvReqHandler), pszTestServiceName);
    132     if (RT_SUCCESS(rc))
    133         rc = RTStrCat(szSrvReqHandler, sizeof(szSrvReqHandler), "SrvReqHandler");
    134     if (RT_FAILURE(rc))
    135     {
    136         RTTestFailed(g_hTest, "RTStrCat failed with rc=%Rrc\n", rc);
    137         return RTTestSummaryAndDestroy(g_hTest);
    138     }
    139 
     130    static char const s_szSrvReqHandlerSuff[] = "SrvReqHandler";
     131    char szSrvReqHandler[sizeof(g_szSrvName) + sizeof(s_szSrvReqHandlerSuff)];
     132    memcpy(mempcpy(szSrvReqHandler, g_szSrvName, g_cchSrvName), s_szSrvReqHandlerSuff, sizeof(s_szSrvReqHandlerSuff));
    140133    for (size_t off = 0; RT_C_IS_LOWER(szSrvReqHandler[off]); off++)
    141134        szSrvReqHandler[off] = RT_C_TO_UPPER(szSrvReqHandler[off]);
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