- Timestamp:
- Sep 28, 2018 5:45:20 PM (6 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/testcase/tstIntNet-1.cpp
r69500 r74530 608 608 * @returns VBox status code. 609 609 * 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. 611 612 */ 612 static int getDefaultIfaceName(char *pszName )613 static int getDefaultIfaceName(char *pszName, size_t cbName) 613 614 { 614 615 FILE *fp = fopen("/proc/net/route", "r"); … … 634 635 { 635 636 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); 639 639 } 640 640 } … … 684 684 * If we fail we still have our reasonable default. 685 685 */ 686 getDefaultIfaceName(szIf );686 getDefaultIfaceName(szIf, sizeof(szIf)); 687 687 const char *pszIf = szIf; 688 688 #elif defined(RT_OS_SOLARIS) … … 862 862 OpenReq.Hdr.cbReq = sizeof(OpenReq); 863 863 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); 866 866 OpenReq.enmTrunkType = *pszIf ? kIntNetTrunkType_NetFlt : kIntNetTrunkType_WhateverNone; 867 867 OpenReq.fFlags = fMacSharing ? INTNET_OPEN_FLAGS_SHARED_MAC_ON_WIRE : 0; -
trunk/src/VBox/Main/src-server/MachineImplMoveVM.cpp
r74003 r74530 1425 1425 1426 1426 MEDIUMTASKCHAINMOVE mtc; 1427 mtc.devType = deviceType; 1427 mtc.devType = deviceType; 1428 mtc.fAttachLinked = false; 1429 mtc.fCreateDiffs = false; 1428 1430 1429 1431 while (!pMedium.isNull()) -
trunk/src/VBox/Main/src-server/linux/NetIf-linux.cpp
r69500 r74530 46 46 * @returns VBox status code. 47 47 * 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. 49 50 */ 50 static int getDefaultIfaceName(char *pszName )51 static int getDefaultIfaceName(char *pszName, size_t cbName) 51 52 { 52 53 FILE *fp = fopen("/proc/net/route", "r"); … … 72 73 { 73 74 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); 77 77 } 78 78 } … … 220 220 { 221 221 char szDefaultIface[256]; 222 int rc = getDefaultIfaceName(szDefaultIface );222 int rc = getDefaultIfaceName(szDefaultIface, sizeof(szDefaultIface)); 223 223 if (RT_FAILURE(rc)) 224 224 { 225 225 Log(("NetIfList: Failed to find default interface.\n")); 226 szDefaultIface[0] = 0;226 szDefaultIface[0] = '\0'; 227 227 } 228 228 int sock = socket(AF_INET, SOCK_DGRAM, 0);
Note:
See TracChangeset
for help on using the changeset viewer.