Browse code

In the Windows version of tun_finalize, on errors that would return -1, set buf->len to 0 rather than -1. While downstream code is set up to consider the buffer invalidated if its length is <= 0, this change makes the code cleaner and safer.

git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@3061 e7ae566f-a301-0410-adde-c780ea21d3b5

james authored on 2008/07/17 07:37:09
Showing 1 changed files
... ...
@@ -2033,7 +2033,12 @@ tun_finalize (
2033 2033
     }
2034 2034
 
2035 2035
   if (buf)
2036
-    buf->len = ret;
2036
+    {
2037
+      if (ret < 0)
2038
+	buf->len = 0;
2039
+      else
2040
+	buf->len = ret;
2041
+    }
2037 2042
   return ret;
2038 2043
 }
2039 2044