summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/transport/gnunet-helper-transport-wlan-dummy.c12
-rw-r--r--src/transport/gnunet-helper-transport-wlan.c2
2 files changed, 9 insertions, 5 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));
diff --git a/src/transport/gnunet-helper-transport-wlan.c b/src/transport/gnunet-helper-transport-wlan.c
index 3b5e0b1ab..2d68c3655 100644
--- a/src/transport/gnunet-helper-transport-wlan.c
+++ b/src/transport/gnunet-helper-transport-wlan.c
@@ -1803,7 +1803,7 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr)
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;