VirtualBox

Changeset 74530 in vbox for trunk


Ignore:
Timestamp:
Sep 28, 2018 5:45:20 PM (6 years ago)
Author:
vboxsync
Message:

Main,Devices: Compile fixes (gcc 8.2.0-7).

Location:
trunk/src/VBox
Files:
3 edited

Legend:

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

    r69500 r74530  
    608608 * @returns VBox status code.
    609609 *
    610  * @param   pszName     The buffer of IFNAMSIZ+1 length where to put the name.
     610 * @param   pszName     The buffer where to put the name.
     611 * @param   cbName      The buffer length.
    611612 */
    612 static int getDefaultIfaceName(char *pszName)
     613static int getDefaultIfaceName(char *pszName, size_t cbName)
    613614{
    614615    FILE *fp = fopen("/proc/net/route", "r");
     
    634635            {
    635636                fclose(fp);
    636                 strncpy(pszName, szIfName, 16);
    637                 pszName[16] = 0;
    638                 return VINF_SUCCESS;
     637                szIfName[sizeof(szIfName) - 1] = '\0';
     638                return RTStrCopy(pszName, cbName, szIfName);
    639639            }
    640640        }
     
    684684     * If we fail we still have our reasonable default.
    685685     */
    686     getDefaultIfaceName(szIf);
     686    getDefaultIfaceName(szIf, sizeof(szIf));
    687687    const char *pszIf = szIf;
    688688#elif defined(RT_OS_SOLARIS)
     
    862862    OpenReq.Hdr.cbReq = sizeof(OpenReq);
    863863    OpenReq.pSession = pSession;
    864     strncpy(OpenReq.szNetwork, pszNetwork, sizeof(OpenReq.szNetwork));
    865     strncpy(OpenReq.szTrunk, pszIf, sizeof(OpenReq.szTrunk));
     864    RTStrCopy(OpenReq.szNetwork, sizeof(OpenReq.szNetwork), pszNetwork);
     865    RTStrCopy(OpenReq.szTrunk, sizeof(OpenReq.szTrunk), pszIf);
    866866    OpenReq.enmTrunkType = *pszIf ? kIntNetTrunkType_NetFlt : kIntNetTrunkType_WhateverNone;
    867867    OpenReq.fFlags = fMacSharing ? INTNET_OPEN_FLAGS_SHARED_MAC_ON_WIRE : 0;
  • trunk/src/VBox/Main/src-server/MachineImplMoveVM.cpp

    r74003 r74530  
    14251425
    14261426            MEDIUMTASKCHAINMOVE mtc;
    1427             mtc.devType = deviceType;
     1427            mtc.devType       = deviceType;
     1428            mtc.fAttachLinked = false;
     1429            mtc.fCreateDiffs  = false;
    14281430
    14291431            while (!pMedium.isNull())
  • trunk/src/VBox/Main/src-server/linux/NetIf-linux.cpp

    r69500 r74530  
    4646 * @returns VBox status code.
    4747 *
    48  * @param   pszName     The buffer of IFNAMSIZ+1 length where to put the name.
     48 * @param   pszName     The buffer where to put the name.
     49 * @param   cbName      Size of of the destination buffer.
    4950 */
    50 static int getDefaultIfaceName(char *pszName)
     51static int getDefaultIfaceName(char *pszName, size_t cbName)
    5152{
    5253    FILE *fp = fopen("/proc/net/route", "r");
     
    7273            {
    7374                fclose(fp);
    74                 strncpy(pszName, szIfName, 16);
    75                 pszName[16] = 0;
    76                 return VINF_SUCCESS;
     75                szIfName[sizeof(szIfName) - 1] = '\0';
     76                return RTStrCopy(pszName, cbName, szIfName);
    7777            }
    7878        }
     
    220220{
    221221    char szDefaultIface[256];
    222     int rc = getDefaultIfaceName(szDefaultIface);
     222    int rc = getDefaultIfaceName(szDefaultIface, sizeof(szDefaultIface));
    223223    if (RT_FAILURE(rc))
    224224    {
    225225        Log(("NetIfList: Failed to find default interface.\n"));
    226         szDefaultIface[0] = 0;
     226        szDefaultIface[0] = '\0';
    227227    }
    228228    int sock = socket(AF_INET, SOCK_DGRAM, 0);
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