summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/main.c b/main.c
index 63e7cbe..cbdb3f8 100644
--- a/main.c
+++ b/main.c
@@ -381,6 +381,7 @@ int handle_request_tunnel_frame(protocol_frame *rcvd_frame)
381 else 381 else
382 { 382 {
383 log_printf(L_ERROR, "Couldn't allocate memory for tunnel\n"); 383 log_printf(L_ERROR, "Couldn't allocate memory for tunnel\n");
384 close(sockfd);
384 } 385 }
385 } 386 }
386 else 387 else
@@ -553,12 +554,14 @@ void parse_lossless_packet(Tox *tox, uint32_t friendnumber, const uint8_t *data,
553 if(len < frame->data_length + PROTOCOL_BUFFER_OFFSET) 554 if(len < frame->data_length + PROTOCOL_BUFFER_OFFSET)
554 { 555 {
555 log_printf(L_WARNING, "Received frame too small (attempted buffer overflow?): %d bytes, excepted at least %d bytes\n", len, frame->data_length + PROTOCOL_BUFFER_OFFSET); 556 log_printf(L_WARNING, "Received frame too small (attempted buffer overflow?): %d bytes, excepted at least %d bytes\n", len, frame->data_length + PROTOCOL_BUFFER_OFFSET);
557 free(frame);
556 return; 558 return;
557 } 559 }
558 560
559 if(frame->data_length > (TOX_MAX_CUSTOM_PACKET_SIZE - PROTOCOL_BUFFER_OFFSET)) 561 if(frame->data_length > (TOX_MAX_CUSTOM_PACKET_SIZE - PROTOCOL_BUFFER_OFFSET))
560 { 562 {
561 log_printf(L_WARNING, "Declared data length too big (attempted buffer overflow?): %d bytes, excepted at most %d bytes\n", frame->data_length, (TOX_MAX_CUSTOM_PACKET_SIZE - PROTOCOL_BUFFER_OFFSET)); 563 log_printf(L_WARNING, "Declared data length too big (attempted buffer overflow?): %d bytes, excepted at most %d bytes\n", frame->data_length, (TOX_MAX_CUSTOM_PACKET_SIZE - PROTOCOL_BUFFER_OFFSET));
564 free(frame);
562 return; 565 return;
563 } 566 }
564 567