summaryrefslogtreecommitdiff
path: root/src/encrypted_packet.c
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2008-12-28 18:42:40 +0000
committerChristian Pointner <equinox@anytun.org>2008-12-28 18:42:40 +0000
commitf90bdf34ce94392fbf705c1ab23fb986bfdec16f (patch)
tree1dfcc9e65c786e9b59010f66170115ad4fcd16c0 /src/encrypted_packet.c
parentadded cipher (net tested yet) (diff)
added forgotten set functions to packets
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)