fix access before null check
authorMatthias Wachs <wachs@net.in.tum.de>
Mon, 13 Feb 2012 13:27:25 +0000 (13:27 +0000)
committerMatthias Wachs <wachs@net.in.tum.de>
Mon, 13 Feb 2012 13:27:25 +0000 (13:27 +0000)
src/transport/plugin_transport_tcp.c

index 6ee14d026da4090da0e85018f9d83b88e269f179..eedb9f910c16b80056077c952132af2fe3d08657 100644 (file)
@@ -1313,11 +1313,13 @@ tcp_plugin_get_session (void *cls,
   const struct IPv4TcpAddress *t4;
   const struct IPv6TcpAddress *t6;
   unsigned int is_natd = GNUNET_NO;
-  size_t addrlen = address->address_length;
+  size_t addrlen = 0;
 
   GNUNET_assert (plugin != NULL);
   GNUNET_assert (address != NULL);
 
+  addrlen = address->address_length;
+
   if (addrlen == sizeof (struct IPv6TcpAddress))
   {
     GNUNET_assert (NULL != address->address);     /* make static analysis happy */