Add missing sanity checks on version-request payload size.
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
struct gb_protocol_version_request *request;
struct gb_protocol_version_response *response;
+ if (op->request->payload_size < sizeof(*request)) {
+ pr_err("%d: short version request (%zu < %zu)\n",
+ connection->intf_cport_id,
+ op->request->payload_size,
+ sizeof(*request));
+ return -EINVAL;
+ }
+
request = op->request->payload;
if (request->major > GB_SVC_VERSION_MAJOR) {