Commit 2ed34261 authored by Olivier Crête's avatar Olivier Crête

pseudotcp: Validate option lengths

parent 3ad583b9
......@@ -1782,6 +1782,9 @@ parse_options (PseudoTcpSocket *self, const guint8 *data, guint32 len)
guint8 kind = TCP_OPT_EOL;
guint8 opt_len;
if (len < pos + 1)
return;
kind = data[pos];
pos++;
......@@ -1793,11 +1796,16 @@ parse_options (PseudoTcpSocket *self, const guint8 *data, guint32 len)
continue;
}
if (len < pos + 1)
return;
// Length of this option.
g_assert(len);
opt_len = data[pos];
pos++;
if (len < pos + opt_len)
return;
// Content of this option.
if (opt_len <= len - pos) {
apply_option (self, kind, data + pos, opt_len);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment