Skip to content

Commit 4f4b9e1

Browse files
committed
Network/NatNet: Fixed memory allocation issue with nameserver translation to NAT engine. bugref: 10268
svn:sync-xref-src-repo-rev: r170331
1 parent 9020a21 commit 4f4b9e1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/VBox/NetworkServices/NAT/VBoxNetSlirpNAT.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Id: VBoxNetSlirpNAT.cpp 110750 2025-08-18 17:07:52Z jack.doherty@oracle.com $ */
1+
/* $Id: VBoxNetSlirpNAT.cpp 110811 2025-08-25 17:36:12Z jack.doherty@oracle.com $ */
22
/** @file
33
* VBoxNetNAT - NAT Service for connecting to IntNet.
44
*/
@@ -701,7 +701,7 @@ int VBoxNetSlirpNAT::initIPv4()
701701
struct Nameserver4List vRealNameservers = getHostNameservers();
702702
if (Nameserver4ListSize(&vRealNameservers) > 0)
703703
{
704-
m_ProxyOptions.aRealNameservers = (struct in_addr *)RTMemAlloc(Nameserver4ListSize(&vRealNameservers));
704+
m_ProxyOptions.aRealNameservers = (struct in_addr *)RTMemAlloc(Nameserver4ListSize(&vRealNameservers) * sizeof(struct in_addr));
705705
if (!m_ProxyOptions.aRealNameservers)
706706
{
707707
reportError("Nameserver array allocation failed.\n");
@@ -1323,7 +1323,7 @@ HRESULT VBoxNetSlirpNAT::HandleEvent(VBoxEventType_T aEventType, IEvent *pEvent)
13231323
struct Nameserver4List vRealNameservers = getHostNameservers();
13241324
if (Nameserver4ListSize(&vRealNameservers) > 0)
13251325
{
1326-
m_ProxyOptions.aRealNameservers = (struct in_addr *)RTMemAlloc(Nameserver4ListSize(&vRealNameservers));
1326+
m_ProxyOptions.aRealNameservers = (struct in_addr *)RTMemAlloc(Nameserver4ListSize(&vRealNameservers) * sizeof(struct in_addr));
13271327
if (!m_ProxyOptions.aRealNameservers)
13281328
{
13291329
reportError("Nameserver array allocation failed.\n");

0 commit comments

Comments
 (0)