gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r20871 - gnunet/src/transport
Date: Tue, 3 Apr 2012 14:16:22 +0200

Author: grothoff
Date: 2012-04-03 14:16:22 +0200 (Tue, 03 Apr 2012)
New Revision: 20871

Modified:
   gnunet/src/transport/gnunet-helper-transport-wlan-dummy.c
   gnunet/src/transport/gnunet-helper-transport-wlan.c
Log:
-fix

Modified: gnunet/src/transport/gnunet-helper-transport-wlan-dummy.c
===================================================================
--- gnunet/src/transport/gnunet-helper-transport-wlan-dummy.c   2012-04-03 
12:10:44 UTC (rev 20870)
+++ gnunet/src/transport/gnunet-helper-transport-wlan-dummy.c   2012-04-03 
12:16:22 UTC (rev 20871)
@@ -80,18 +80,22 @@
   const struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *in;
   size_t payload_size;
   struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage newheader;
+  uint16_t sendsize;
 
+  sendsize = ntohs (hdr->size);
   in = (const struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) hdr;
   if ( (GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER != ntohs (hdr->type)) ||
-       (sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage) < ntohs 
(hdr->size)) )
+       (sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage) > sendsize) )
   {
-    fprintf (stderr, "Function stdin_send: wrong packet type or size\n");
+    fprintf (stderr, "Received malformed message\n",
+            (unsigned int) sendsize,
+            (unsigned int) ntohs (hdr->type));
     exit (1);
   }
-  payload_size = ntohs (hdr->size) - sizeof (struct 
GNUNET_TRANSPORT_WLAN_RadiotapSendMessage);
+  payload_size = sendsize - sizeof (struct 
GNUNET_TRANSPORT_WLAN_RadiotapSendMessage);
   if ((payload_size + sizeof (struct 
GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage) + write_pout->size) > MAXLINE * 2)
   {
-    fprintf (stderr, "Function stdin_send: Packet too big for buffer\n");
+    fprintf (stderr, "Packet too big for buffer\n");
     exit (1);
   }
   memset (&newheader, 0, sizeof (newheader));

Modified: gnunet/src/transport/gnunet-helper-transport-wlan.c
===================================================================
--- gnunet/src/transport/gnunet-helper-transport-wlan.c 2012-04-03 12:10:44 UTC 
(rev 20870)
+++ gnunet/src/transport/gnunet-helper-transport-wlan.c 2012-04-03 12:16:22 UTC 
(rev 20871)
@@ -1803,7 +1803,7 @@
   sendsize -= (sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage) - 
sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame));
   if (MAXLINE < sendsize)
   {
-    fprintf (stderr, "Function stdin_send_hw: Packet too big for buffer\n");
+    fprintf (stderr, "Packet too big for buffer\n");
     exit (1);
   }
   header = (const struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) hdr;




reply via email to

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