Received cookie length wasn't checked resulting in a heap overflow with
an arbitrary data received in the frame if the contents was larger than
a fixed size buffer. Fix this by explicitly checking there buffer to be
sufficient large.
Fixes: 59299a8a7d59 ("P2P2: Add bootstrapping support with PD frames")
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
p2p_dbg(p2p, "Truncated PBMA");
return;
}
+
+ if (cookie_len > sizeof(dev->bootstrap_params->cookie)) {
+ p2p_dbg(p2p, "Too long PBMA cookie");
+ return;
+ }
+
cookie = pos;
dev->bootstrap_params =