gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r30568 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r30568 - gnunet/src/transport
Date: Wed, 6 Nov 2013 17:17:49 +0100

Author: wachs
Date: 2013-11-06 17:17:49 +0100 (Wed, 06 Nov 2013)
New Revision: 30568

Modified:
   gnunet/src/transport/plugin_transport_http_common.c
Log:
test for address to sock


Modified: gnunet/src/transport/plugin_transport_http_common.c
===================================================================
--- gnunet/src/transport/plugin_transport_http_common.c 2013-11-06 15:56:02 UTC 
(rev 30567)
+++ gnunet/src/transport/plugin_transport_http_common.c 2013-11-06 16:17:49 UTC 
(rev 30568)
@@ -414,33 +414,40 @@
   struct sockaddr_storage *s;
   (*res) = GNUNET_SYSERR;
   char * to_conv;
+  size_t urlen;
 
   ha = (const struct HttpAddress *) addr;
   if (NULL == addr)
-       {
-               GNUNET_break (0);
-               return NULL;
-       }
+  {
+    GNUNET_break(0);
+    return NULL ;
+  }
   if (0 >= addrlen)
-       {
-               GNUNET_break (0);
-               return NULL;
-       }
-  if (addrlen < sizeof (struct HttpAddress))
-       {
-               GNUNET_break (0);
-               return NULL;
-       }
-  if (addrlen < sizeof (struct HttpAddress) + ntohl (ha->urlen))
-       {
-               /* This is a legacy addresses */
-               return NULL;
-       }
-  if (((char *) addr)[addrlen-1] != '\0')
-       {
-               GNUNET_break (0);
-               return NULL;
-       }
+  {
+    GNUNET_break(0);
+    return NULL ;
+  }
+  if (addrlen < sizeof(struct HttpAddress))
+  {
+    GNUNET_break(0);
+    return NULL ;
+  }
+  urlen = ntohl (ha->urlen);
+  if (sizeof(struct HttpAddress) + urlen != addrlen)
+  {
+    /* This is a legacy addresses */
+    return NULL ;
+  }
+  if (addrlen < sizeof(struct HttpAddress) + urlen)
+  {
+    /* This is a legacy addresses */
+    return NULL ;
+  }
+  if (((char *) addr)[addrlen - 1] != '\0')
+  {
+    GNUNET_break(0);
+    return NULL ;
+  }
   spa = http_split_address ((const char *) &ha[1]);
   if (NULL == spa)
   {




reply via email to

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