diff options
Diffstat (limited to 'src/transport/gnunet-communicator-quic.c')
-rw-r--r-- | src/transport/gnunet-communicator-quic.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/src/transport/gnunet-communicator-quic.c b/src/transport/gnunet-communicator-quic.c index 566ad4287..e2fd970bf 100644 --- a/src/transport/gnunet-communicator-quic.c +++ b/src/transport/gnunet-communicator-quic.c | |||
@@ -238,6 +238,13 @@ recv_from_streams (struct PeerAddress *peer) | |||
238 | */ | 238 | */ |
239 | if (GNUNET_NO == peer->id_recvd) | 239 | if (GNUNET_NO == peer->id_recvd) |
240 | { | 240 | { |
241 | if (recv_len < sizeof(struct GNUNET_PeerIdentity)) | ||
242 | { | ||
243 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
244 | "message recv len of %zd less than length of peer identity\n", | ||
245 | recv_len); | ||
246 | return; | ||
247 | } | ||
241 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 248 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
242 | "receiving peer identity\n"); | 249 | "receiving peer identity\n"); |
243 | struct GNUNET_PeerIdentity *pid = (struct | 250 | struct GNUNET_PeerIdentity *pid = (struct |
@@ -247,8 +254,15 @@ recv_from_streams (struct PeerAddress *peer) | |||
247 | buf_ptr += sizeof(struct GNUNET_PeerIdentity); | 254 | buf_ptr += sizeof(struct GNUNET_PeerIdentity); |
248 | recv_len -= sizeof(struct GNUNET_PeerIdentity); | 255 | recv_len -= sizeof(struct GNUNET_PeerIdentity); |
249 | } | 256 | } |
257 | |||
258 | if (recv_len < sizeof(struct GNUNET_MessageHeader)) | ||
259 | { | ||
260 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
261 | "message recv len of %zd less than length of message header\n", | ||
262 | recv_len); | ||
263 | } | ||
250 | hdr = (struct GNUNET_MessageHeader *) buf_ptr; | 264 | hdr = (struct GNUNET_MessageHeader *) buf_ptr; |
251 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "passing %lu bytes to core\n", | 265 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "passing %zd bytes to core\n", |
252 | recv_len); | 266 | recv_len); |
253 | GNUNET_TRANSPORT_communicator_receive (ch, &peer->target, hdr, | 267 | GNUNET_TRANSPORT_communicator_receive (ch, &peer->target, hdr, |
254 | ADDRESS_VALIDITY_PERIOD, NULL, NULL); | 268 | ADDRESS_VALIDITY_PERIOD, NULL, NULL); |
@@ -1214,7 +1228,7 @@ sock_read (void *cls) | |||
1214 | out, sizeof(out)); | 1228 | out, sizeof(out)); |
1215 | if (0 > written) | 1229 | if (0 > written) |
1216 | { | 1230 | { |
1217 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1231 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1218 | "quiche failed to generate version negotiation packet\n"); | 1232 | "quiche failed to generate version negotiation packet\n"); |
1219 | return; | 1233 | return; |
1220 | } | 1234 | } |
@@ -1225,7 +1239,7 @@ sock_read (void *cls) | |||
1225 | salen); | 1239 | salen); |
1226 | if (sent != written) | 1240 | if (sent != written) |
1227 | { | 1241 | { |
1228 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1242 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1229 | "failed to send version negotiation packet to peer\n"); | 1243 | "failed to send version negotiation packet to peer\n"); |
1230 | return; | 1244 | return; |
1231 | } | 1245 | } |
@@ -1251,8 +1265,9 @@ sock_read (void *cls) | |||
1251 | quic_header.version, out, sizeof(out)); | 1265 | quic_header.version, out, sizeof(out)); |
1252 | if (0 > written) | 1266 | if (0 > written) |
1253 | { | 1267 | { |
1254 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1268 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1255 | "quiche failed to write retry packet\n"); | 1269 | "quiche failed to write retry packet\n"); |
1270 | return; | ||
1256 | } | 1271 | } |
1257 | ssize_t sent = GNUNET_NETWORK_socket_sendto (udp_sock, | 1272 | ssize_t sent = GNUNET_NETWORK_socket_sendto (udp_sock, |
1258 | out, | 1273 | out, |
@@ -1261,7 +1276,8 @@ sock_read (void *cls) | |||
1261 | salen); | 1276 | salen); |
1262 | if (written != sent) | 1277 | if (written != sent) |
1263 | { | 1278 | { |
1264 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "failed to send retry packet\n"); | 1279 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "failed to send retry packet\n"); |
1280 | return; | ||
1265 | } | 1281 | } |
1266 | 1282 | ||
1267 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "sent %zd bytes\n", sent); | 1283 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "sent %zd bytes\n", sent); |
@@ -1271,8 +1287,9 @@ sock_read (void *cls) | |||
1271 | &sa, salen, | 1287 | &sa, salen, |
1272 | quic_header.odcid, &quic_header.odcid_len)) | 1288 | quic_header.odcid, &quic_header.odcid_len)) |
1273 | { | 1289 | { |
1274 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1290 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1275 | "invalid address validation token created\n"); | 1291 | "invalid address validation token created\n"); |
1292 | return; | ||
1276 | } | 1293 | } |
1277 | peer->conn = create_conn (quic_header.dcid, quic_header.dcid_len, | 1294 | peer->conn = create_conn (quic_header.dcid, quic_header.dcid_len, |
1278 | quic_header.odcid, quic_header.odcid_len, | 1295 | quic_header.odcid, quic_header.odcid_len, |
@@ -1282,6 +1299,7 @@ sock_read (void *cls) | |||
1282 | { | 1299 | { |
1283 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1300 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1284 | "failed to create quic connection with peer\n"); | 1301 | "failed to create quic connection with peer\n"); |
1302 | return; | ||
1285 | } | 1303 | } |
1286 | } // null connection | 1304 | } // null connection |
1287 | 1305 | ||