Skip to content
Snippets Groups Projects
Commit 6705ef8d authored by Martin Nilsson's avatar Martin Nilsson
Browse files

Size check was broken and didn't return an alert properly (though would break...

Size check was broken and didn't return an alert properly (though would break later as no data was added).
parent fff7faf1
Branches
Tags
No related merge requests found
...@@ -36,24 +36,25 @@ protected void create(ProtocolVersion version, void|int extra) ...@@ -36,24 +36,25 @@ protected void create(ProtocolVersion version, void|int extra)
protected object check_size(string data, int extra) protected object check_size(string data, int extra)
{ {
if (sizeof(data) > (PACKET_MAX_SIZE + extra)) if (sizeof(data) > (PACKET_MAX_SIZE + extra))
return Alert(ALERT_fatal, ALERT_unexpected_message, version); return Alert(ALERT_fatal, ALERT_record_overflow, version);
marginal_size = extra; marginal_size = extra;
fragment = data; fragment = data;
return 0;
} }
object set_plaintext(string data) object set_plaintext(string data)
{ {
check_size(data, 0); return check_size(data, 0);
} }
object set_compressed(string data) object set_compressed(string data)
{ {
check_size(data, 1024); return check_size(data, 1024);
} }
object set_encrypted(string data) object set_encrypted(string data)
{ {
check_size(data, 2048); return check_size(data, 2048);
} }
//! Receive data read from the network. //! Receive data read from the network.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment