Changeset 70599 in vbox
- Timestamp:
- Jan 16, 2018 3:36:41 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 120309
- Location:
- trunk/src/VBox/Main/src-client
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/HGCM.cpp
r69500 r70599 105 105 VBOXHGCMSVCFNTABLE m_fntable; 106 106 107 int m_cClients;108 int m_cClientsAllocated;107 uint32_t m_cClients; 108 uint32_t m_cClientsAllocated; 109 109 110 110 uint32_t *m_paClientIds; … … 1201 1201 * The global state of a service is configured during VM startup. 1202 1202 */ 1203 int i;1203 uint32_t i; 1204 1204 1205 1205 for (i = 0; i < pSvc->m_cClients; i++) … … 1376 1376 if (m_cClients == m_cClientsAllocated) 1377 1377 { 1378 m_paClientIds = (uint32_t *)RTMemRealloc(m_paClientIds, (m_cClientsAllocated + 64) * 1379 sizeof(m_paClientIds[0])); 1380 Assert(m_paClientIds); 1381 m_cClientsAllocated += 64; 1378 const uint32_t cDelta = 64; 1379 1380 /* Guards against integer overflow on 32bit arch and also limits size of m_paClientIds array to 4GB*/ 1381 if (m_cClientsAllocated < UINT32_MAX / sizeof(m_paClientIds[0]) - cDelta) 1382 { 1383 uint32_t *paClientIdsNew; 1384 1385 paClientIdsNew = (uint32_t *)RTMemRealloc(m_paClientIds, (m_cClientsAllocated + cDelta) * 1386 sizeof(m_paClientIds[0])); 1387 Assert(paClientIdsNew); 1388 1389 if (paClientIdsNew) 1390 { 1391 m_paClientIds = paClientIdsNew; 1392 m_cClientsAllocated += cDelta; 1393 } 1394 else 1395 { 1396 rc = VERR_NO_MEMORY; 1397 } 1398 } 1399 else 1400 { 1401 rc = VERR_NO_MEMORY; 1402 } 1382 1403 } 1383 1404 … … 1443 1464 1444 1465 /* Remove the client id from the array in any case, rc does not matter. */ 1445 int i;1466 uint32_t i; 1446 1467 1447 1468 for (i = 0; i < m_cClients; i++) -
trunk/src/VBox/Main/src-client/VMMDevInterface.cpp
r69500 r70599 617 617 } 618 618 619 /* Check if service name is a string terminated by zero*/ 620 size_t cchInfo = 0; 621 if (RTStrNLenEx(pServiceLocation->u.host.achName, sizeof(pServiceLocation->u.host.achName), &cchInfo) != VINF_SUCCESS) 622 { 623 return VERR_INVALID_PARAMETER; 624 } 625 619 626 if (!pDrv->pVMMDev || !pDrv->pVMMDev->hgcmIsActive()) 620 627 return VERR_INVALID_STATE; 621 622 628 return HGCMGuestConnect(pDrv->pHGCMPort, pCmd, pServiceLocation->u.host.achName, pu32ClientID); 623 629 }
Note:
See TracChangeset
for help on using the changeset viewer.