diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-07-08 17:20:23 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-07-08 17:20:23 +0000 |
commit | d8c53b12a818ff7cf82d06a1a69c395bdef85ee6 (patch) | |
tree | 0ebb0db416c157fcfde51a941185819dd12d51fd /src/transport/gnunet-helper-transport-wlan-dummy.c | |
parent | 5184c17d32a39c928c2a0fec3ee1ad098bbaa562 (diff) | |
download | gnunet-d8c53b12a818ff7cf82d06a1a69c395bdef85ee6.tar.gz gnunet-d8c53b12a818ff7cf82d06a1a69c395bdef85ee6.zip |
-avoid calling memcpy() with NULL argument, even if len is 0
Diffstat (limited to 'src/transport/gnunet-helper-transport-wlan-dummy.c')
-rw-r--r-- | src/transport/gnunet-helper-transport-wlan-dummy.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/transport/gnunet-helper-transport-wlan-dummy.c b/src/transport/gnunet-helper-transport-wlan-dummy.c index 3a9cb8397..684546314 100644 --- a/src/transport/gnunet-helper-transport-wlan-dummy.c +++ b/src/transport/gnunet-helper-transport-wlan-dummy.c | |||
@@ -103,12 +103,12 @@ send_mac_to_plugin (char *buffer, struct GNUNET_TRANSPORT_WLAN_MacAddress *mac) | |||
103 | 103 | ||
104 | struct GNUNET_TRANSPORT_WLAN_HelperControlMessage macmsg; | 104 | struct GNUNET_TRANSPORT_WLAN_HelperControlMessage macmsg; |
105 | 105 | ||
106 | memcpy (&macmsg.mac, | 106 | GNUNET_memcpy (&macmsg.mac, |
107 | (char *) mac, | 107 | (char *) mac, |
108 | sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)); | 108 | sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)); |
109 | macmsg.hdr.size = htons (sizeof (struct GNUNET_TRANSPORT_WLAN_HelperControlMessage)); | 109 | macmsg.hdr.size = htons (sizeof (struct GNUNET_TRANSPORT_WLAN_HelperControlMessage)); |
110 | macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL); | 110 | macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL); |
111 | memcpy (buffer, | 111 | GNUNET_memcpy (buffer, |
112 | &macmsg, | 112 | &macmsg, |
113 | sizeof (struct GNUNET_TRANSPORT_WLAN_HelperControlMessage)); | 113 | sizeof (struct GNUNET_TRANSPORT_WLAN_HelperControlMessage)); |
114 | return sizeof (struct GNUNET_TRANSPORT_WLAN_HelperControlMessage); | 114 | return sizeof (struct GNUNET_TRANSPORT_WLAN_HelperControlMessage); |
@@ -150,11 +150,11 @@ stdin_send (void *cls, void *client, const struct GNUNET_MessageHeader *hdr) | |||
150 | newheader.header.size = htons (payload_size + sizeof (newheader)); | 150 | newheader.header.size = htons (payload_size + sizeof (newheader)); |
151 | newheader.header.type = htons (GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER); | 151 | newheader.header.type = htons (GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER); |
152 | newheader.frame = in->frame; | 152 | newheader.frame = in->frame; |
153 | memcpy (write_pout->buf + write_pout->size, | 153 | GNUNET_memcpy (write_pout->buf + write_pout->size, |
154 | &newheader, | 154 | &newheader, |
155 | sizeof (newheader)); | 155 | sizeof (newheader)); |
156 | write_pout->size += sizeof (newheader); | 156 | write_pout->size += sizeof (newheader); |
157 | memcpy (write_pout->buf + write_pout->size, | 157 | GNUNET_memcpy (write_pout->buf + write_pout->size, |
158 | &in[1], | 158 | &in[1], |
159 | payload_size); | 159 | payload_size); |
160 | write_pout->size += payload_size; | 160 | write_pout->size += payload_size; |
@@ -181,7 +181,7 @@ file_in_send (void *cls, void *client, const struct GNUNET_MessageHeader *hdr) | |||
181 | FPRINTF (stderr, "%s", "Packet too big for buffer\n"); | 181 | FPRINTF (stderr, "%s", "Packet too big for buffer\n"); |
182 | exit (1); | 182 | exit (1); |
183 | } | 183 | } |
184 | memcpy (write_std->buf + write_std->size, hdr, sendsize); | 184 | GNUNET_memcpy (write_std->buf + write_std->size, hdr, sendsize); |
185 | write_std->size += sendsize; | 185 | write_std->size += sendsize; |
186 | return GNUNET_OK; | 186 | return GNUNET_OK; |
187 | } | 187 | } |