Index: trunk/src/VBox/Main/glue/initterm.cpp
===================================================================
--- trunk/src/VBox/Main/glue/initterm.cpp	(revision 47114)
+++ trunk/src/VBox/Main/glue/initterm.cpp	(revision 47117)
@@ -346,6 +346,6 @@
         return NS_ERROR_FILE_ACCESS_DENIED;
     AssertRCReturn(vrc, NS_ERROR_FAILURE);
-    strcpy(szXptiDat, szCompReg);
-
+    vrc = RTStrCopy(szXptiDat, sizeof(szXptiDat), szCompReg);
+    AssertRCReturn(vrc, NS_ERROR_FAILURE);
     vrc = RTPathAppend(szCompReg, sizeof(szCompReg), "compreg.dat");
     AssertRCReturn(vrc, NS_ERROR_FAILURE);
@@ -397,6 +397,5 @@
         {
             /* Iterate over all other paths */
-            szAppHomeDir[RTPATH_MAX - 1] = '\0';
-            strncpy(szAppHomeDir, kAppPathsToProbe[i], RTPATH_MAX - 1);
+            RTStrCopy(szAppHomeDir, sizeof(szAppHomeDir), kAppPathsToProbe[i]);
             vrc = VINF_SUCCESS;
         }
@@ -406,7 +405,12 @@
             continue;
         }
-
         char szCompDir[RTPATH_MAX];
-        vrc = RTPathAppend(strcpy(szCompDir, szAppHomeDir), sizeof(szCompDir), "components");
+        vrc = RTStrCopy(szCompDir, sizeof(szCompDir), szAppHomeDir);
+        if (RT_FAILURE(vrc))
+        {
+            rc = NS_ERROR_FAILURE;
+            continue;
+        }
+        vrc = RTPathAppend(szCompDir, sizeof(szCompDir), "components");
         if (RT_FAILURE(vrc))
         {
Index: trunk/src/VBox/Main/include/netif.h
===================================================================
--- trunk/src/VBox/Main/include/netif.h	(revision 47114)
+++ trunk/src/VBox/Main/include/netif.h	(revision 47117)
@@ -129,5 +129,5 @@
         return VERR_INVALID_PARAMETER;
 
-    memset(aAddrPtr, 0, sizeof(RTNETADDRIPV6));
+    RT_ZERO(*aAddrPtr);
 
     ASMBitSetRange(aAddrPtr, 0, cPrefix);
Index: trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
===================================================================
--- trunk/src/VBox/Main/src-client/ConsoleImpl.cpp	(revision 47114)
+++ trunk/src/VBox/Main/src-client/ConsoleImpl.cpp	(revision 47117)
@@ -405,8 +405,8 @@
     LogFlowThisFunc(("\n"));
 
-    memset(mapStorageLeds, 0, sizeof(mapStorageLeds));
-    memset(mapNetworkLeds, 0, sizeof(mapNetworkLeds));
-    memset(&mapUSBLed, 0, sizeof(mapUSBLed));
-    memset(&mapSharedFolderLed, 0, sizeof(mapSharedFolderLed));
+    RT_ZERO(mapStorageLeds);
+    RT_ZERO(mapNetworkLeds);
+    RT_ZERO(mapUSBLed);
+    RT_ZERO(mapSharedFolderLed);
 
     for (unsigned i = 0; i < RT_ELEMENTS(maStorageDevType); ++i)
@@ -8297,5 +8297,5 @@
          */
         struct ifreq IfReq;
-        memset(&IfReq, 0, sizeof(IfReq));
+        RT_ZERO(IfReq);
         /* The name of the TAP interface we are using */
         Bstr tapDeviceName;
@@ -8313,8 +8313,5 @@
             /* If we are using a static TAP device then try to open it. */
             Utf8Str str(tapDeviceName);
-            if (str.length() <= sizeof(IfReq.ifr_name))
-                strcpy(IfReq.ifr_name, str.c_str());
-            else
-                memcpy(IfReq.ifr_name, str.c_str(), sizeof(IfReq.ifr_name) - 1); /** @todo bitch about names which are too long... */
+            RTStrCopy(IfReq.ifr_name, sizeof(IfReq.ifr_name), str.c_str()); /** @todo bitch about names which are too long... */
             IfReq.ifr_flags = IFF_TAP | IFF_NO_PI;
             rcVBox = ioctl(maTapFD[slot], TUNSETIFF, &IfReq);
Index: trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp
===================================================================
--- trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp	(revision 47114)
+++ trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp	(revision 47117)
@@ -1915,5 +1915,5 @@
             Assert(strlen(macStr) == 12);
             RTMAC Mac;
-            memset(&Mac, 0, sizeof(Mac));
+            RT_ZERO(Mac);
             char *pMac = (char*)&Mac;
             for (uint32_t i = 0; i < 6; ++i)
@@ -4397,5 +4397,5 @@
                         struct ifreq Req;
                         RT_ZERO(Req);
-                        strncpy(Req.ifr_name, pszBridgedIfName, sizeof(Req.ifr_name) - 1);
+                        RTStrCopy(Req.ifr_name, sizeof(Req.ifr_name), pszBridgedIfName);
                         if (ioctl(iSock, SIOCGIFFLAGS, &Req) >= 0)
                             if ((Req.ifr_flags & IFF_UP) == 0)
@@ -4446,5 +4446,5 @@
                     struct iwreq WRq;
 
-                    memset(&WRq, 0, sizeof(WRq));
+                    RT_ZERO(WRq);
                     strncpy(WRq.ifr_name, pszBridgedIfName, IFNAMSIZ);
                     bool fSharedMacOnWire = ioctl(iSock, SIOCGIWNAME, &WRq) >= 0;
@@ -4467,5 +4467,5 @@
                     uint8_t abData[32];
 
-                    memset(&WReq, 0, sizeof(WReq));
+                    RT_ZERO(WReq);
                     strncpy(WReq.i_name, pszBridgedIfName, sizeof(WReq.i_name));
                     WReq.i_type = IEEE80211_IOC_SSID;
Index: trunk/src/VBox/Main/src-client/ConsoleVRDPServer.cpp
===================================================================
--- trunk/src/VBox/Main/src-client/ConsoleVRDPServer.cpp	(revision 47114)
+++ trunk/src/VBox/Main/src-client/ConsoleVRDPServer.cpp	(revision 47117)
@@ -1351,5 +1351,5 @@
     m_InputSynch.fClientScrollLock = false;
 
-    memset(maFramebuffers, 0, sizeof(maFramebuffers));
+    RT_ZERO(maFramebuffers);
 
     {
@@ -1377,6 +1377,6 @@
      */
     m_fInterfaceImage = false;
-    memset(&m_interfaceImage, 0, sizeof (m_interfaceImage));
-    memset(&m_interfaceCallbacksImage, 0, sizeof (m_interfaceCallbacksImage));
+    RT_ZERO(m_interfaceImage);
+    RT_ZERO(m_interfaceCallbacksImage);
     RT_ZERO(m_interfaceMousePtr);
     RT_ZERO(m_interfaceSCard);
@@ -1416,5 +1416,5 @@
     {
         RTCritSectDelete(&mCritSect);
-        memset(&mCritSect, 0, sizeof(mCritSect));
+        RT_ZERO(mCritSect);
     }
 
@@ -1422,5 +1422,5 @@
     {
         RTCritSectDelete(&mTSMFLock);
-        memset(&mTSMFLock, 0, sizeof(mTSMFLock));
+        RT_ZERO(mTSMFLock);
     }
 }
@@ -2586,5 +2586,5 @@
                 pThis->tsmfUnlock();
 
-                memset(pVRDPCtx, 0, sizeof(*pVRDPCtx));
+                RT_ZERO(*pVRDPCtx);
                 RTMemFree(pVRDPCtx);
             }
Index: trunk/src/VBox/Main/src-client/DisplayImpl.cpp
===================================================================
--- trunk/src/VBox/Main/src-client/DisplayImpl.cpp	(revision 47114)
+++ trunk/src/VBox/Main/src-client/DisplayImpl.cpp	(revision 47117)
@@ -149,5 +149,5 @@
     {
         RTCritSectDelete (&mVBVALock);
-        memset (&mVBVALock, 0, sizeof (mVBVALock));
+        RT_ZERO(mVBVALock);
     }
 
@@ -155,5 +155,5 @@
     {
         RTCritSectDelete(&mSaveSeamlessRectLock);
-        memset(&mSaveSeamlessRectLock, 0, sizeof (mSaveSeamlessRectLock));
+        RT_ZERO(mSaveSeamlessRectLock);
     }
     BaseFinalRelease();
@@ -489,10 +489,10 @@
         maFramebuffers[ul].mpSavedVisibleRegion = NULL;
 
-        memset (&maFramebuffers[ul].dirtyRect, 0 , sizeof (maFramebuffers[ul].dirtyRect));
-        memset (&maFramebuffers[ul].pendingResize, 0 , sizeof (maFramebuffers[ul].pendingResize));
+        RT_ZERO(maFramebuffers[ul].dirtyRect);
+        RT_ZERO(maFramebuffers[ul].pendingResize);
 #ifdef VBOX_WITH_HGSMI
         maFramebuffers[ul].fVBVAEnabled = false;
         maFramebuffers[ul].cVBVASkipUpdate = 0;
-        memset (&maFramebuffers[ul].vbvaSkippedRect, 0, sizeof (maFramebuffers[ul].vbvaSkippedRect));
+        RT_ZERO(maFramebuffers[ul].vbvaSkippedRect);
         maFramebuffers[ul].pVBVAHostFlags = NULL;
 #endif /* VBOX_WITH_HGSMI */
@@ -1244,5 +1244,5 @@
         DISPLAYFBINFO *pFBInfo = &prgn->paFramebuffers[uScreenId];
 
-        memset (&pFBInfo->dirtyRect, 0, sizeof (pFBInfo->dirtyRect));
+        RT_ZERO(pFBInfo->dirtyRect);
     }
 }
Index: trunk/src/VBox/Main/src-client/HGCM.cpp
===================================================================
--- trunk/src/VBox/Main/src-client/HGCM.cpp	(revision 47114)
+++ trunk/src/VBox/Main/src-client/HGCM.cpp	(revision 47117)
@@ -243,5 +243,5 @@
     m_hExtension (NULL)
 {
-    memset (&m_fntable, 0, sizeof (m_fntable));
+    RT_ZERO(m_fntable);
 }
 
@@ -290,5 +290,5 @@
         if (RT_SUCCESS(rc))
         {
-            memset (&m_fntable, 0, sizeof (m_fntable));
+            RT_ZERO(m_fntable);
 
             m_fntable.cbSize     = sizeof (m_fntable);
@@ -346,5 +346,5 @@
     }
 
-    memset (&m_fntable, 0, sizeof (m_fntable));
+    RT_ZERO(m_fntable);
     m_pfnLoad = NULL;
     m_hLdrMod = NIL_RTLDRMOD;
Index: trunk/src/VBox/Main/src-client/HGCMThread.cpp
===================================================================
--- trunk/src/VBox/Main/src-client/HGCMThread.cpp	(revision 47114)
+++ trunk/src/VBox/Main/src-client/HGCMThread.cpp	(revision 47117)
@@ -221,5 +221,5 @@
     m_handle (0)
 {
-    memset (&m_critsect, 0, sizeof (m_critsect));
+    RT_ZERO(m_critsect);
 }
 
@@ -307,5 +307,5 @@
             {
                 Log(("hgcmThreadCreate: FAILURE: Can't init a critical section for a hgcm worker thread.\n"));
-                memset (&m_critsect, 0, sizeof (m_critsect));
+                RT_ZERO(m_critsect);
             }
         }
Index: trunk/src/VBox/Main/src-client/RemoteUSBBackend.cpp
===================================================================
--- trunk/src/VBox/Main/src-client/RemoteUSBBackend.cpp	(revision 47114)
+++ trunk/src/VBox/Main/src-client/RemoteUSBBackend.cpp	(revision 47117)
@@ -962,5 +962,5 @@
     {
         AssertFailed ();
-        memset (&mCritsect, 0, sizeof (mCritsect));
+        RT_ZERO(mCritsect);
     }
 
Index: trunk/src/VBox/Main/src-server/HostImpl.cpp
===================================================================
--- trunk/src/VBox/Main/src-server/HostImpl.cpp	(revision 47114)
+++ trunk/src/VBox/Main/src-server/HostImpl.cpp	(revision 47117)
@@ -253,7 +253,7 @@
 
     RT_ZERO(g_aszResolvConf);
-    RTStrmPrintf(g_aszResolvConf, MAX_PATH, "%/RESOLV2", _PATH_ETC);
+    RTStrmPrintf(g_aszResolvConf, sizeof(g_aszResolvConf), "%/RESOLV2", _PATH_ETC);
 # else
-    strcpy(g_aszResolvConf, "/etc/resolv.conf");
+    RTStrCopy(g_aszResolvConf, sizeof(g_aszResolvConf), "/etc/resolv.conf");
 # endif    
     return g_aszResolvConf;
Index: trunk/src/VBox/Main/src-server/darwin/NetIf-darwin.cpp
===================================================================
--- trunk/src/VBox/Main/src-server/darwin/NetIf-darwin.cpp	(revision 47114)
+++ trunk/src/VBox/Main/src-server/darwin/NetIf-darwin.cpp	(revision 47117)
@@ -86,5 +86,5 @@
 
         struct ifreq IfReq;
-        strcpy(IfReq.ifr_name, pNew->szShortName);
+        RTStrCopy(IfReq.ifr_name, sizeof(IfReq.ifr_name), pNew->szShortName);
         if (ioctl(sock, SIOCGIFFLAGS, &IfReq) < 0)
         {
@@ -392,5 +392,5 @@
         {
             struct ifreq IfReq;
-            strcpy(IfReq.ifr_name, pNew->szShortName);
+            RTStrCopy(IfReq.ifr_name, sizeof(IfReq.ifr_name), pNew->szShortName);
             if (ioctl(sock, SIOCGIFFLAGS, &IfReq) < 0)
             {
@@ -512,5 +512,5 @@
 
             struct ifreq IfReq;
-            strcpy(IfReq.ifr_name, pInfo->szShortName);
+            RTStrCopy(IfReq.ifr_name, sizeof(IfReq.ifr_name), pInfo->szShortName);
             if (ioctl(sock, SIOCGIFFLAGS, &IfReq) < 0)
             {
Index: trunk/src/VBox/Main/src-server/darwin/iokit.cpp
===================================================================
--- trunk/src/VBox/Main/src-server/darwin/iokit.cpp	(revision 47114)
+++ trunk/src/VBox/Main/src-server/darwin/iokit.cpp	(revision 47117)
@@ -374,5 +374,5 @@
             CFIndex iCF;
         } u;
-        memset(&u, 0, sizeof(u));
+        RT_ZERO(u);
         CFNumberType NumType = CFNumberGetType((CFNumberRef)pvValue);
         if (CFNumberGetValue((CFNumberRef)pvValue, NumType, &u))
Index: trunk/src/VBox/Main/src-server/freebsd/HostHardwareFreeBSD.cpp
===================================================================
--- trunk/src/VBox/Main/src-server/freebsd/HostHardwareFreeBSD.cpp	(revision 47114)
+++ trunk/src/VBox/Main/src-server/freebsd/HostHardwareFreeBSD.cpp	(revision 47117)
@@ -173,6 +173,6 @@
         struct dev_match_result *paMatches = NULL;
 
-        memset(&DeviceCCB, 0, sizeof(union ccb));
-        memset(&DeviceMatchPattern, 0, sizeof(struct device_match_pattern));
+        RT_ZERO(DeviceCCB);
+        RT_ZERO(DeviceMatchPattern);
 
         /* We want to get all devices. */
@@ -237,7 +237,7 @@
                         unsigned iPeriphMatch = 0;
 
-                        memset(&PeriphCCB, 0, sizeof(union ccb));
-                        memset(&PeriphMatchPattern, 0, sizeof(struct dev_match_pattern));
-                        memset(aPeriphMatches, 0, sizeof(aPeriphMatches));
+                        RT_ZERO(PeriphCCB);
+                        RT_ZERO(PeriphMatchPattern);
+                        RT_ZERO(aPeriphMatches);
 
                         /* This time we only want the specific nodes for the device. */
Index: trunk/src/VBox/Main/src-server/freebsd/NetIf-freebsd.cpp
===================================================================
--- trunk/src/VBox/Main/src-server/freebsd/NetIf-freebsd.cpp	(revision 47114)
+++ trunk/src/VBox/Main/src-server/freebsd/NetIf-freebsd.cpp	(revision 47117)
@@ -272,5 +272,5 @@
         {
             struct ifreq IfReq;
-            strcpy(IfReq.ifr_name, pNew->szShortName);
+            RTStrCopy(IfReq.ifr_name, sizeof(IfReq.ifr_name), pNew->szShortName);
             if (ioctl(sock, SIOCGIFFLAGS, &IfReq) < 0)
             {
@@ -389,5 +389,5 @@
 
             struct ifreq IfReq;
-            strcpy(IfReq.ifr_name, pInfo->szShortName);
+            RTSTrCopy(IfReq.ifr_name, sizeof(IfReq.ifr_name), pInfo->szShortName);
             if (ioctl(sock, SIOCGIFFLAGS, &IfReq) < 0)
             {
Index: trunk/src/VBox/Main/src-server/freebsd/USBProxyServiceFreeBSD.cpp
===================================================================
--- trunk/src/VBox/Main/src-server/freebsd/USBProxyServiceFreeBSD.cpp	(revision 47114)
+++ trunk/src/VBox/Main/src-server/freebsd/USBProxyServiceFreeBSD.cpp	(revision 47117)
@@ -267,5 +267,5 @@
 
         struct usb_device_info UsbDevInfo;
-        memset(&UsbDevInfo, 0, sizeof(struct usb_device_info));
+        RT_ZERO(UsbDevInfo);
 
         rc = ioctl(FileUsb, USB_GET_DEVICEINFO, &UsbDevInfo);
Index: trunk/src/VBox/Main/src-server/generic/AutostartDb-generic.cpp
===================================================================
--- trunk/src/VBox/Main/src-server/generic/AutostartDb-generic.cpp	(revision 47114)
+++ trunk/src/VBox/Main/src-server/generic/AutostartDb-generic.cpp	(revision 47117)
@@ -79,5 +79,5 @@
                     uint32_t cAutostartVms = 0;
 
-                    memset(abBuf, 0, sizeof(abBuf));
+                    RT_ZERO(abBuf);
 
                     /* Check if the file was just created. */
Index: trunk/src/VBox/Main/src-server/generic/NetIf-generic.cpp
===================================================================
--- trunk/src/VBox/Main/src-server/generic/NetIf-generic.cpp	(revision 47114)
+++ trunk/src/VBox/Main/src-server/generic/NetIf-generic.cpp	(revision 47117)
@@ -381,6 +381,6 @@
         return VERR_OUT_OF_RESOURCES;
     struct ifreq Req;
-    memset(&Req, 0, sizeof(Req));
-    strncpy(Req.ifr_name, pcszIfName, sizeof(Req.ifr_name) - 1);
+    RT_ZERO(Req);
+    RTStrCopy(Req.ifr_name, sizeof(Req.ifr_name), pcszIfName);
     if (ioctl(sock, SIOCGIFFLAGS, &Req) < 0)
     {
Index: trunk/src/VBox/Main/src-server/linux/NetIf-linux.cpp
===================================================================
--- trunk/src/VBox/Main/src-server/linux/NetIf-linux.cpp	(revision 47114)
+++ trunk/src/VBox/Main/src-server/linux/NetIf-linux.cpp	(revision 47117)
@@ -119,6 +119,6 @@
     // memset(pInfo, 0, sizeof(*pInfo));
     struct ifreq Req;
-    memset(&Req, 0, sizeof(Req));
-    strncpy(Req.ifr_name, pszName, sizeof(Req.ifr_name) - 1);
+    RT_ZERO(Req);
+    RTStrCopy(Req.ifr_name, sizeof(Req.ifr_name), pszName);
     if (ioctl(iSocket, SIOCGIFHWADDR, &Req) >= 0)
     {
@@ -164,5 +164,5 @@
             for (;;)
             {
-                memset(szName, 0, sizeof(szName));
+                RT_ZERO(szName);
                 int n = fscanf(fp,
                                "%08x%08x%08x%08x"
@@ -288,6 +288,6 @@
         return VERR_OUT_OF_RESOURCES;
     struct ifreq Req;
-    memset(&Req, 0, sizeof(Req));
-    strncpy(Req.ifr_name, pcszIfName, sizeof(Req.ifr_name) - 1);
+    RT_ZERO(Req);
+    RTStrCopy(Req.ifr_name, sizeof(Req.ifr_name), pcszIfName);
     if (ioctl(sock, SIOCGIFHWADDR, &Req) >= 0)
     {
Index: trunk/src/VBox/Main/src-server/linux/USBGetDevices.cpp
===================================================================
--- trunk/src/VBox/Main/src-server/linux/USBGetDevices.cpp	(revision 47114)
+++ trunk/src/VBox/Main/src-server/linux/USBGetDevices.cpp	(revision 47117)
@@ -594,5 +594,5 @@
 
                     /* Reset device state */
-                    memset(&Dev, 0, sizeof (Dev));
+                    RT_ZERO(Dev);
                     Dev.enmState = USBDEVICESTATE_UNUSED;
                     cHits = 1;
Index: trunk/src/VBox/Main/src-server/linux/USBProxyServiceLinux.cpp
===================================================================
--- trunk/src/VBox/Main/src-server/linux/USBProxyServiceLinux.cpp	(revision 47114)
+++ trunk/src/VBox/Main/src-server/linux/USBProxyServiceLinux.cpp	(revision 47117)
@@ -321,5 +321,5 @@
     }
 
-    memset(&PollFds, 0, sizeof(PollFds));
+    RT_ZERO(PollFds);
     PollFds[0].fd        = RTFileToNative(mhFile);
     PollFds[0].events    = POLLIN;
Index: trunk/src/VBox/Main/src-server/solaris/NetIf-solaris.cpp
===================================================================
--- trunk/src/VBox/Main/src-server/solaris/NetIf-solaris.cpp	(revision 47114)
+++ trunk/src/VBox/Main/src-server/solaris/NetIf-solaris.cpp	(revision 47117)
@@ -205,5 +205,5 @@
     {
         struct lifreq IfReq;
-        strcpy(IfReq.lifr_name, szNICInstance);
+        RTStrCopy(IfReq.lifr_name, sizeof(IfReq.lifr_name), szNICInstance);
         if (ioctl(Sock, SIOCGLIFADDR, &IfReq) >= 0)
         {
@@ -244,5 +244,5 @@
     {
         struct lifreq IfReq;
-        strcpy(IfReq.lifr_name, szNICInstance);
+        RTStrCopy(IfReq.lifr_name, sizeof(IfReq.lifr_name), szNICInstance);
         if (ioctl(Sock, SIOCGLIFADDR, &IfReq) >= 0)
         {
Index: trunk/src/VBox/Main/src-server/win/NetIf-win.cpp
===================================================================
--- trunk/src/VBox/Main/src-server/win/NetIf-win.cpp	(revision 47114)
+++ trunk/src/VBox/Main/src-server/win/NetIf-win.cpp	(revision 47117)
@@ -955,5 +955,5 @@
         {
             NETIFINFO Info;
-            memset(&Info, 0, sizeof(Info));
+            RT_ZERO(Info);
             Info.Uuid = *(Guid(IfGuid).raw());
             rc = collectNetIfInfo(name, Guid(IfGuid), &Info, iDefaultInterface);
Index: trunk/src/VBox/Main/src-server/xpcom/server_module.cpp
===================================================================
--- trunk/src/VBox/Main/src-server/xpcom/server_module.cpp	(revision 47114)
+++ trunk/src/VBox/Main/src-server/xpcom/server_module.cpp	(revision 47117)
@@ -54,7 +54,6 @@
 #include <iprt/process.h>
 #include <iprt/env.h>
+#include <iprt/string.h>
 #include <iprt/thread.h>
-
-#include <string.h>
 
 #if defined(RT_OS_SOLARIS)
@@ -138,5 +137,5 @@
 
     char msg[10];
-    memset(msg, '\0', sizeof(msg));
+    RT_ZERO(msg);
     if (   PR_Read(readable, msg, sizeof(msg)-1) != 5
         || strcmp(msg, "READY"))
