gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r25438 - gnunet/src/vpn


From: gnunet
Subject: [GNUnet-SVN] r25438 - gnunet/src/vpn
Date: Thu, 13 Dec 2012 11:25:29 +0100

Author: grothoff
Date: 2012-12-13 11:25:29 +0100 (Thu, 13 Dec 2012)
New Revision: 25438

Modified:
   gnunet/src/vpn/gnunet-helper-vpn-windows.c
Log:
-comments

Modified: gnunet/src/vpn/gnunet-helper-vpn-windows.c
===================================================================
--- gnunet/src/vpn/gnunet-helper-vpn-windows.c  2012-12-13 09:22:15 UTC (rev 
25437)
+++ gnunet/src/vpn/gnunet-helper-vpn-windows.c  2012-12-13 10:25:29 UTC (rev 
25438)
@@ -86,13 +86,13 @@
 #define _tpopen       _popen
 #endif
 
-/*
+/**
  * Our local process' PID. Used for creating a sufficiently unique additional 
  * hardware ID for our device.
  */
 static TCHAR secondary_hwid[LINE_LEN / 2];
 
-/*
+/**
  * Device's visible Name, used to identify a network device in netsh.
  * eg: "Local Area Connection 9"
  */
@@ -188,7 +188,7 @@
   if (0 != ret)
     {
       _ftprintf (stderr, _T ("Setting IPv6 address failed: %s\n"), strerror 
(ret));
-      exit (1);
+      exit (1); // FIXME: return error code, shut down interface / unload 
driver
     }
 }
 
@@ -222,7 +222,7 @@
   if (0 != ret)
     {
       _ftprintf (stderr, _T ("Setting IPv4 address failed: %s\n"), strerror 
(ret));
-      exit (1);
+      exit (1);  // FIXME: return error code, shut down interface / unload 
driver
     }
 }
 
@@ -396,7 +396,7 @@
   /* Of course there is a multitude of entries here, with arbitrary names, 
    * thus we need to iterate through there.
    */
-  while (FALSE == retval)
+  while (! retval)
     {
       TCHAR instance_key[256];
       TCHAR query_key [256];
@@ -486,21 +486,13 @@
 /**
  * Creates a tun-interface called dev;
  *
- * @param hwid is asumed to point to a TCHAR[LINE_LEN]
- *        if *dev == '\\0', uses the name supplied by the kernel;
  * @return the fd to the tun or -1 on error
  */
 static int
-init_tun (TCHAR *hwid)
+init_tun ()
 {
   int fd=-1;
 
-  if (NULL == hwid)
-    {
-      errno = EINVAL;
-      return -1;
-    }
-
   if (!setup_interface ())
     {
       errno = ENODEV;
@@ -578,9 +570,9 @@
    */
   _itot (_getpid (), pid_as_string, 10);
   strncpy (secondary_hwid, hwid, LINE_LEN);
-  strncat (secondary_hwid, pid_as_string, LINE_LEN);
+  strncat (secondary_hwid, pid_as_string, LINE_LEN); // BUFFER OVERFLOW!
 
-  if (-1 == (fd_tun = init_tun (hwid)))
+  if (-1 == (fd_tun = init_tun ()))
     {
       fprintf (stderr, "Fatal: could not initialize virtual-interface %s with 
IPv6 %s/%s and IPv4 %s/%s\n",
                hwid,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]