-fix
authorChristian Grothoff <christian@grothoff.org>
Fri, 20 Jan 2012 17:21:05 +0000 (17:21 +0000)
committerChristian Grothoff <christian@grothoff.org>
Fri, 20 Jan 2012 17:21:05 +0000 (17:21 +0000)
src/vpn/vpn_api.c

index f7759a3bc32d16b9255d85a58955eaed1f376053..3f8d0452393b8872df0884412bfbddd08fdb095c 100644 (file)
@@ -261,7 +261,8 @@ transmit_request (void *cls,
   while ( (NULL != rr) &&
          (0 != rr->request_id) )
     rr = rr->next;
-  if (NULL == rr)
+  if ( (NULL == rr) ||
+       (0 == size) )
     return 0;
 
   /* if first request, start receive loop */
@@ -272,6 +273,7 @@ transmit_request (void *cls,
   if (NULL == rr->addr)
   {
     ret = sizeof (struct RedirectToServiceRequestMessage);
+    GNUNET_assert (ret <= size);
     rs.header.size = htons ((uint16_t) ret);
     rs.header.type = htons (GNUNET_MESSAGE_TYPE_VPN_CLIENT_REDIRECT_TO_SERVICE);
     rs.nac = htonl (rr->nac);
@@ -298,6 +300,7 @@ transmit_request (void *cls,
       return 0;
     }
     ret = alen + sizeof (struct RedirectToIpRequestMessage);
+    GNUNET_assert (ret <= size);
     rip.header.size = htons ((uint16_t) ret);
     rip.header.type = htons (GNUNET_MESSAGE_TYPE_VPN_CLIENT_REDIRECT_TO_IP);
     rip.nac = htonl (rr->nac);