Index: trunk/src/VBox/Main/src-server/solaris/NetIf-solaris.cpp
===================================================================
--- trunk/src/VBox/Main/src-server/solaris/NetIf-solaris.cpp	(revision 98020)
+++ trunk/src/VBox/Main/src-server/solaris/NetIf-solaris.cpp	(revision 98021)
@@ -116,8 +116,8 @@
     {
         kstat_named_t *kn;
-        if ((kn = (kstat_named_t *)kstat_data_lookup(ksAdapter, (char *)"ifspeed")) == 0)
+        if ((kn = (kstat_named_t *)kstat_data_lookup(ksAdapter, (char *)"ifspeed")) != NULL)
+            uSpeed = (uint32_t)(kn->value.ul / 1000000); /* bits -> Mbits */
+        else
             LogRel(("kstat_data_lookup(ifspeed) -> %d, name=%s\n", errno, name));
-        else
-            uSpeed = kn->value.ul / 1000000; /* bits -> Mbits */
     }
     kstat_close(kc);
@@ -130,5 +130,5 @@
     /* Don't query interface speed for inactive interfaces (see @bugref{6345}). */
     if (pInfo->enmStatus == NETIF_S_UP)
-        pInfo->uSpeedMbits =  kstatGet(pInfo->szShortName);
+        pInfo->uSpeedMbits = kstatGet(pInfo->szShortName);
     else
         pInfo->uSpeedMbits = 0;
@@ -430,5 +430,5 @@
 }
 
-int NetIfList(std::list <ComObjPtr<HostNetworkInterface> > &list)
+int NetIfList(std::list<ComObjPtr<HostNetworkInterface> > &list)
 {
     /*
@@ -465,13 +465,13 @@
         {
             int cIfaces = RT_MIN(1024, IfNum.lifn_count); /* sane limit */
-            int cbIfaces = cIfaces * sizeof(struct lifreq);
-            struct lifreq *Ifaces = (struct lifreq *)RTMemTmpAlloc(cbIfaces);
-            if (Ifaces)
+            size_t cbIfaces = (unsigned)RT_MAX(cIfaces, 1) * sizeof(struct lifreq);
+            struct lifreq *paIfaces = (struct lifreq *)RTMemTmpAlloc(cbIfaces);
+            if (paIfaces)
             {
                 struct lifconf IfConfig;
                 RT_ZERO(IfConfig);
                 IfConfig.lifc_family = AF_INET;
-                IfConfig.lifc_len = cbIfaces;
-                IfConfig.lifc_buf = (caddr_t)Ifaces;
+                IfConfig.lifc_len = (int)cbIfaces;
+                IfConfig.lifc_buf = (caddr_t)paIfaces;
                 rc = ioctl(Sock, SIOCGLIFCONF, &IfConfig);
                 if (!rc)
@@ -482,16 +482,16 @@
                          * Skip loopback interfaces.
                          */
-                        if (!strncmp(Ifaces[i].lifr_name, RT_STR_TUPLE("lo")))
+                        if (!strncmp(paIfaces[i].lifr_name, RT_STR_TUPLE("lo")))
                             continue;
 
 #if 0
-                        rc = ioctl(Sock, SIOCGLIFADDR, &(Ifaces[i]));
+                        rc = ioctl(Sock, SIOCGLIFADDR, &(paIfaces[i]));
                         if (rc >= 0)
                         {
-                            memcpy(Info.IPAddress.au8, ((struct sockaddr *)&Ifaces[i].lifr_addr)->sa_data,
+                            memcpy(Info.IPAddress.au8, ((struct sockaddr *)&paIfaces[i].lifr_addr)->sa_data,
                                    sizeof(Info.IPAddress.au8));
                             // SIOCGLIFNETMASK
                             struct arpreq ArpReq;
-                            memcpy(&ArpReq.arp_pa, &Ifaces[i].lifr_addr, sizeof(struct sockaddr_in));
+                            memcpy(&ArpReq.arp_pa, &paIfaces[i].lifr_addr, sizeof(struct sockaddr_in));
 
                             /*
@@ -506,5 +506,5 @@
 
                             char szNICDesc[LIFNAMSIZ + 256];
-                            char *pszIface = Ifaces[i].lifr_name;
+                            char *pszIface = paIfaces[i].lifr_name;
                             strcpy(szNICDesc, pszIface);
 
@@ -513,9 +513,8 @@
 #endif
 
-                        char *pszIface = Ifaces[i].lifr_name;
-                        vboxSolarisAddLinkHostIface(pszIface, &list);
+                        vboxSolarisAddLinkHostIface(paIfaces[i].lifr_name, &list);
                     }
                 }
-                RTMemTmpFree(Ifaces);
+                RTMemTmpFree(paIfaces);
             }
         }
