summaryrefslogtreecommitdiff
path: root/src/encrypted_packet.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/encrypted_packet.c')
-rw-r--r--src/encrypted_packet.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/encrypted_packet.c b/src/encrypted_packet.c
index 0f76589..176241b 100644
--- a/src/encrypted_packet.c
+++ b/src/encrypted_packet.c
@@ -96,7 +96,13 @@ u_int32_t encrypted_packet_get_payload_length(encrypted_packet_t* packet)
void encrypted_packet_set_payload_length(encrypted_packet_t* packet, u_int32_t len)
{
+ if(!packet)
+ return;
+ if(len > ENCRYPTED_PACKET_SIZE_MAX || (len + sizeof(encrypted_packet_header_t)) > ENCRYPTED_PACKET_SIZE_MAX)
+ len = ENCRYPTED_PACKET_SIZE_MAX - sizeof(encrypted_packet_header_t);
+
+ packet->payload_length_ = len;
}
seq_nr_t encrypted_packet_get_seq_nr(encrypted_packet_t* packet)