aboutsummaryrefslogtreecommitdiffstats
path: root/src/tls/session_ticket.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tls/session_ticket.cpp')
-rw-r--r--src/tls/session_ticket.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/tls/session_ticket.cpp b/src/tls/session_ticket.cpp
index 47a8a5c32..273996a16 100644
--- a/src/tls/session_ticket.cpp
+++ b/src/tls/session_ticket.cpp
@@ -35,13 +35,13 @@ New_Session_Ticket::New_Session_Ticket(Record_Writer& writer,
New_Session_Ticket::New_Session_Ticket(const MemoryRegion<byte>& buf) :
m_ticket_lifetime_hint(0)
{
- if(buf.size() >= 6)
- {
- TLS_Data_Reader reader(buf);
+ if(buf.size() < 6)
+ throw Decoding_Error("Session ticket message too short to be valid");
- m_ticket_lifetime_hint = reader.get_u32bit();
- m_ticket = reader.get_range<byte>(2, 0, 65535);
- }
+ TLS_Data_Reader reader(buf);
+
+ m_ticket_lifetime_hint = reader.get_u32bit();
+ m_ticket = reader.get_range<byte>(2, 0, 65535);
}
MemoryVector<byte> New_Session_Ticket::serialize() const