From 308ee8aa1fd28102d078431a199106bc47d10128 Mon Sep 17 00:00:00 2001 From: David Binder Date: Wed, 1 Feb 2017 17:38:55 -0500 Subject: [PATCH] staging: unisys: visorbus: Check controlvm message payload size Checks the controlvm message's payload size before copying it into a parser_context struct's name region. Signed-off-by: David Binder Signed-off-by: David Kershner Reported-by: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorbus/visorchipset.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index 4e630ea527e8..df2dfeb14027 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -399,6 +399,10 @@ parser_name_get(struct parser_context *ctx) struct spar_controlvm_parameters_header *phdr = NULL; phdr = (struct spar_controlvm_parameters_header *)(ctx->data); + + if (phdr->name_offset + phdr->name_length > ctx->param_bytes) + return NULL; + ctx->curr = ctx->data + phdr->name_offset; ctx->bytes_remaining = phdr->name_length; return parser_string_get(ctx); -- 2.20.1