summaryrefslogtreecommitdiff
path: root/src/transport/gnunet-helper-transport-wlan-dummy.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-04-03 12:16:22 +0000
committerChristian Grothoff <christian@grothoff.org>2012-04-03 12:16:22 +0000
commite7dcc206d3644f49a494370c36757704369b7007 (patch)
tree12f60b23fe4af52525f245e9bc09419d39a27241 /src/transport/gnunet-helper-transport-wlan-dummy.c
parentbc04203f71e022e30d53a411f9c49a0a0a9890ef (diff)
-fix
Diffstat (limited to 'src/transport/gnunet-helper-transport-wlan-dummy.c')
-rw-r--r--src/transport/gnunet-helper-transport-wlan-dummy.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/transport/gnunet-helper-transport-wlan-dummy.c b/src/transport/gnunet-helper-transport-wlan-dummy.c
index 86e5d4684..476b403a5 100644
--- a/src/transport/gnunet-helper-transport-wlan-dummy.c
+++ b/src/transport/gnunet-helper-transport-wlan-dummy.c
@@ -80,18 +80,22 @@ stdin_send (void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
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));