aboutsummaryrefslogtreecommitdiffstats
path: root/src/tls
diff options
context:
space:
mode:
authorlloyd <[email protected]>2011-12-28 16:51:08 +0000
committerlloyd <[email protected]>2011-12-28 16:51:08 +0000
commitf501568f586735f06afd1822dcb7ed9ec4bc129d (patch)
tree134a5b06225c8eb963dc3032779616fdc0a80343 /src/tls
parentbff93678cf13da4ecca1851234578e671787a38b (diff)
Assert there is nothing left over at the end of packet parsing.
Diffstat (limited to 'src/tls')
-rw-r--r--src/tls/tls_reader.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/tls/tls_reader.h b/src/tls/tls_reader.h
index 3a45235b5..a7ef512e9 100644
--- a/src/tls/tls_reader.h
+++ b/src/tls/tls_reader.h
@@ -22,6 +22,12 @@ class TLS_Data_Reader
TLS_Data_Reader(const MemoryRegion<byte>& buf_in) :
buf(buf_in), offset(0) {}
+ ~TLS_Data_Reader()
+ {
+ if(has_remaining())
+ throw Decoding_Error("Extra bytes at end of message");
+ }
+
size_t remaining_bytes() const
{
return buf.size() - offset;