Index: /trunk/src/VBox/Devices/Network/slirp/debug.c
===================================================================
--- /trunk/src/VBox/Devices/Network/slirp/debug.c	(revision 22872)
+++ /trunk/src/VBox/Devices/Network/slirp/debug.c	(revision 22873)
@@ -194,5 +194,5 @@
     QSOCKET_FOREACH(so, so_next, tcp)
     /* { */
-        n = sprintf(buff, "tcp[%s]", so->so_tcpcb?tcpstates[so->so_tcpcb->t_state]:"NONE");
+        n = RTStrPrintf(buff, sizeof(buff), "tcp[%s]", so->so_tcpcb?tcpstates[so->so_tcpcb->t_state]:"NONE");
         while (n < 17)
             buff[n++] = ' ';
@@ -208,5 +208,5 @@
     QSOCKET_FOREACH(so, so_next, udp)
     /* { */
-        n = sprintf(buff, "udp[%d sec]", (so->so_expire - curtime) / 1000);
+        n = RTStrPrintf(buff, sizeof(buff), "udp[%d sec]", (so->so_expire - curtime) / 1000);
         while (n < 17)
             buff[n++] = ' ';
Index: /trunk/src/VBox/Devices/Network/slirp/debug.h
===================================================================
--- /trunk/src/VBox/Devices/Network/slirp/debug.h	(revision 22872)
+++ /trunk/src/VBox/Devices/Network/slirp/debug.h	(revision 22873)
@@ -18,4 +18,6 @@
 
 #include <VBox/log.h>
+/* we've excluded stdio.h */
+# define FILE void
 
 #ifdef LOG_ENABLED
Index: /trunk/src/VBox/Devices/Network/slirp/libalias/alias_ftp.c
===================================================================
--- /trunk/src/VBox/Devices/Network/slirp/libalias/alias_ftp.c	(revision 22872)
+++ /trunk/src/VBox/Devices/Network/slirp/libalias/alias_ftp.c	(revision 22873)
@@ -676,22 +676,43 @@
                 if (ftp_message_type == FTP_PORT_COMMAND) {
                     /* Generate PORT command string. */
+#ifndef VBOX
                     sprintf(stemp, "PORT %d,%d,%d,%d,%d,%d\r\n",
                         a1, a2, a3, a4, p1, p2);
+#else
+                    RTStrPrintf(stemp, sizeof(stemp), "PORT %d,%d,%d,%d,%d,%d\r\n",
+                        a1, a2, a3, a4, p1, p2);
+#endif
                 } else {
                     /* Generate 227 reply string. */
+#ifndef VBOX
                     sprintf(stemp,
                         "227 Entering Passive Mode (%d,%d,%d,%d,%d,%d)\r\n",
                         a1, a2, a3, a4, p1, p2);
+#else
+                    RTStrPrintf(stemp, sizeof(stemp),
+                        "227 Entering Passive Mode (%d,%d,%d,%d,%d,%d)\r\n",
+                        a1, a2, a3, a4, p1, p2);
+#endif
                 }
                 break;
             case FTP_EPRT_COMMAND:
                 /* Generate EPRT command string. */
+#ifndef VBOX
                 sprintf(stemp, "EPRT |1|%d.%d.%d.%d|%d|\r\n",
                     a1, a2, a3, a4, ntohs(alias_port));
+#else
+                RTStrPrintf(stemp, sizeof(stemp), "EPRT |1|%d.%d.%d.%d|%d|\r\n",
+                    a1, a2, a3, a4, ntohs(alias_port));
+#endif
                 break;
             case FTP_229_REPLY:
                 /* Generate 229 reply string. */
+#ifndef VBOX
                 sprintf(stemp, "229 Entering Extended Passive Mode (|||%d|)\r\n",
                     ntohs(alias_port));
+#else
+                RTStrPrintf(stemp, sizeof(stemp), "229 Entering Extended Passive Mode (|||%d|)\r\n",
+                    ntohs(alias_port));
+#endif
                 break;
             }
Index: /trunk/src/VBox/Devices/Network/slirp/slirp.c
===================================================================
--- /trunk/src/VBox/Devices/Network/slirp/slirp.c	(revision 22872)
+++ /trunk/src/VBox/Devices/Network/slirp/slirp.c	(revision 22873)
@@ -7,4 +7,5 @@
 #include <VBox/pdmdrv.h>
 #include <iprt/assert.h>
+#include <iprt/file.h>
 #ifndef RT_OS_WINDOWS
 # include <sys/ioctl.h>
@@ -331,4 +332,27 @@
 #else /* !RT_OS_WINDOWS */
 
+static int RTFileGets(RTFILE File, void *pvBuf, size_t cbBufSize, size_t *pcbRead)
+{
+    size_t cbRead;
+    char bTest;
+    int rc = VERR_NO_MEMORY;
+    char *pu8Buf = (char *)pvBuf;
+    *pcbRead = 0;
+    while(   RT_SUCCESS(rc = RTFileRead(File, &bTest, 1, &cbRead)) 
+          && (pu8Buf - (char *)pvBuf) < cbBufSize)
+    {
+        if (cbRead == 0)
+            return VERR_EOF;
+        if (bTest == '\r' || bTest == '\n')
+        {
+            *pu8Buf = 0;
+            return VINF_SUCCESS;
+        }
+        *pu8Buf = bTest;
+         pu8Buf++;
+        (*pcbRead)++;
+    }
+    return rc;
+}
 static int get_dns_addr_domain(PNATState pData, bool fVerbose,
                                struct in_addr *pdns_addr,
@@ -337,7 +361,9 @@
     char buff[512];
     char buff2[256];
-    FILE *f = NULL;
+    RTFILE f;
     int found = 0;
     struct in_addr tmp_addr;
+    int rc;
+    size_t bytes;
 
 #ifdef RT_OS_OS2
@@ -346,25 +372,25 @@
     if (etc)
     {
-        snprintf(buff, sizeof(buff), "%s/RESOLV2", etc);
-        f = fopen(buff, "rt");
-    }
-    if (!f)
-    {
-        snprintf(buff, sizeof(buff), "%s/RESOLV2", _PATH_ETC);
-        f = fopen(buff, "rt");
-    }
-    if (!f)
-    {
-        snprintf(buff, sizeof(buff), "%s/resolv.conf", _PATH_ETC);
-        f = fopen(buff, "rt");
+        RTStrmPrintf(buff, sizeof(buff), "%s/RESOLV2", etc);
+        rc = RTFileOpen(&f, buff, RTFILE_O_READ);
+    }
+    if (RT_FAILURE(rc))
+    {
+        RTStrmPrintf(buff, sizeof(buff), "%s/RESOLV2", _PATH_ETC);
+        rc = RTFileOpen(&f, buff, RTFILE_O_READ);
+    }
+    if (RT_FAILURE(rc))
+    {
+        RTStrmPrintf(buff, sizeof(buff), "%s/resolv.conf", _PATH_ETC);
+        rc = RTFileOpen(&f, buff, RTFILE_O_READ);
     }
 #else
-#ifndef DEBUG_vvl
-    f = fopen("/etc/resolv.conf", "r");
-#else
+# ifndef DEBUG_vvl
+    rc = RTFileOpen(&f, "/etc/resolv.conf", RTFILE_O_READ);
+# else
     char *home = getenv("HOME");
-    snprintf(buff, sizeof(buff), "%s/resolv.conf", home);
-    f = fopen(buff, "r");
-    if (f != NULL)
+    RTStrPrintf(buff, sizeof(buff), "%s/resolv.conf", home);
+    rc = RTFileOpen(&f, buff, RTFILE_O_READ);
+    if (RT_SUCCESS(rc))
     {
         Log(("NAT: DNS we're using %s\n", buff));
@@ -372,10 +398,10 @@
     else
     {
-        f = fopen("/etc/resolv.conf", "r");
+        rc = RTFileOpen(&f, "/etc/resolv.conf", RTFILE_O_READ);
         Log(("NAT: DNS we're using %s\n", buff));
     }
-#endif
-#endif
-    if (!f)
+# endif
+#endif
+    if (RT_FAILURE(rc))
         return -1;
 
@@ -383,5 +409,6 @@
         *ppszDomain = NULL;
     Log(("nat: DNS Servers:\n"));
-    while (fgets(buff, 512, f) != NULL)
+    while (    RT_SUCCESS(rc = RTFileGets(f, buff, 512, &bytes))
+            && rc != VERR_EOF)
     {
         struct dns_entry *da = NULL;
@@ -434,5 +461,5 @@
         }
     }
-    fclose(f);
+    RTFileClose(f);
     if (!found)
         return -1;
Index: /trunk/src/VBox/Devices/Network/slirp/slirp.h
===================================================================
--- /trunk/src/VBox/Devices/Network/slirp/slirp.h	(revision 22872)
+++ /trunk/src/VBox/Devices/Network/slirp/slirp.h	(revision 22873)
@@ -128,6 +128,6 @@
 #endif
 
-#include <stdio.h>
 #include <errno.h>
+
 
 #ifndef HAVE_MEMMOVE
@@ -343,4 +343,10 @@
 };
 AssertCompileSize(struct ethhdr, 14);
+
+/*
+ * (vvl) externing of sscanf.
+ */
+int sscanf(const char *s, const char *format, ...);
+
 #if defined(VBOX_SLIRP_ALIAS)
 
@@ -367,5 +373,6 @@
 
 # define strncasecmp RTStrNICmp
-
+# define stderr NULL 
+# define stdout NULL 
 # ifdef DEBUG
 # define LIBALIAS_DEBUG
Index: /trunk/src/VBox/Devices/Network/slirp/tftp.c
===================================================================
--- /trunk/src/VBox/Devices/Network/slirp/tftp.c	(revision 22872)
+++ /trunk/src/VBox/Devices/Network/slirp/tftp.c	(revision 22873)
@@ -137,6 +137,6 @@
 
     tp->tp_op = htons(TFTP_OACK);
-    n += sprintf((char *)tp->x.tp_buf + n, "%s", key) + 1;
-    n += sprintf((char *)tp->x.tp_buf + n, "%u", value) + 1;
+    n += RTStrPrintf((char *)tp->x.tp_buf + n, M_FREEROOM(m), "%s", key) + 1;
+    n += RTStrPrintf((char *)tp->x.tp_buf + n, M_FREEROOM(m), "%u", value) + 1;
 
     saddr.sin_addr = recv_tp->ip.ip_dst;
