diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-04-03 12:16:22 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-04-03 12:16:22 +0000 |
commit | e7dcc206d3644f49a494370c36757704369b7007 (patch) | |
tree | 12f60b23fe4af52525f245e9bc09419d39a27241 /src/transport/gnunet-helper-transport-wlan-dummy.c | |
parent | bc04203f71e022e30d53a411f9c49a0a0a9890ef (diff) | |
download | gnunet-e7dcc206d3644f49a494370c36757704369b7007.tar.gz gnunet-e7dcc206d3644f49a494370c36757704369b7007.zip |
-fix
Diffstat (limited to 'src/transport/gnunet-helper-transport-wlan-dummy.c')
-rw-r--r-- | src/transport/gnunet-helper-transport-wlan-dummy.c | 12 |
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) | |||
80 | const struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *in; | 80 | const struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *in; |
81 | size_t payload_size; | 81 | size_t payload_size; |
82 | struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage newheader; | 82 | struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage newheader; |
83 | uint16_t sendsize; | ||
83 | 84 | ||
85 | sendsize = ntohs (hdr->size); | ||
84 | in = (const struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) hdr; | 86 | in = (const struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) hdr; |
85 | if ( (GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER != ntohs (hdr->type)) || | 87 | if ( (GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER != ntohs (hdr->type)) || |
86 | (sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage) < ntohs (hdr->size)) ) | 88 | (sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage) > sendsize) ) |
87 | { | 89 | { |
88 | fprintf (stderr, "Function stdin_send: wrong packet type or size\n"); | 90 | fprintf (stderr, "Received malformed message\n", |
91 | (unsigned int) sendsize, | ||
92 | (unsigned int) ntohs (hdr->type)); | ||
89 | exit (1); | 93 | exit (1); |
90 | } | 94 | } |
91 | payload_size = ntohs (hdr->size) - sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage); | 95 | payload_size = sendsize - sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage); |
92 | if ((payload_size + sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage) + write_pout->size) > MAXLINE * 2) | 96 | if ((payload_size + sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage) + write_pout->size) > MAXLINE * 2) |
93 | { | 97 | { |
94 | fprintf (stderr, "Function stdin_send: Packet too big for buffer\n"); | 98 | fprintf (stderr, "Packet too big for buffer\n"); |
95 | exit (1); | 99 | exit (1); |
96 | } | 100 | } |
97 | memset (&newheader, 0, sizeof (newheader)); | 101 | memset (&newheader, 0, sizeof (newheader)); |