diff options
author | Randall Spangler <rspangler@chromium.org> | 2012-07-11 15:56:34 -0700 |
---|---|---|
committer | Gerrit <chrome-bot@google.com> | 2012-07-12 11:32:06 -0700 |
commit | 02f0ad7ea8b955d456e1e692e6e6e1a7199f2de1 (patch) | |
tree | 587675bd9d001646cd1540e2c3124fed4e8bd797 /common | |
parent | 347b5062a429922cabfa49de8f11fe8cebf8f9f1 (diff) | |
download | chrome-ec-02f0ad7ea8b955d456e1e692e6e6e1a7199f2de1.tar.gz |
Pass maximum size of response buffer in via host command handler args
BUG=chrome-os-partner:11275
TEST=from u-boot prompt, 'mkbp hash'
Change-Id: I4cf37acfdd8e4edfe2cb6259b0fc6d0860ef0f79
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27225
Diffstat (limited to 'common')
-rw-r--r-- | common/flash_commands.c | 3 | ||||
-rw-r--r-- | common/host_command.c | 2 | ||||
-rw-r--r-- | common/pstore_commands.c | 2 |
3 files changed, 2 insertions, 5 deletions
diff --git a/common/flash_commands.c b/common/flash_commands.c index d8953bc3c7..590e090b0e 100644 --- a/common/flash_commands.c +++ b/common/flash_commands.c @@ -207,9 +207,6 @@ static int flash_command_read(struct host_cmd_handler_args *args) const struct ec_params_flash_read *p = (const struct ec_params_flash_read *)args->params; - if (p->size > EC_PARAM_SIZE) - return EC_RES_INVALID_PARAM; - if (flash_dataptr(p->offset, p->size, 1, (char **)&args->response) < 0) return EC_RES_ERROR; diff --git a/common/host_command.c b/common/host_command.c index 716119b909..3e0ea06d5d 100644 --- a/common/host_command.c +++ b/common/host_command.c @@ -146,7 +146,7 @@ static int host_command_read_memmap(struct host_cmd_handler_args *args) uint8_t offset = p->offset; uint8_t size = p->size; - if (size > EC_PARAM_SIZE || offset > EC_MEMMAP_SIZE || + if (size > EC_MEMMAP_SIZE || offset > EC_MEMMAP_SIZE || offset + size > EC_MEMMAP_SIZE) return EC_RES_INVALID_PARAM; diff --git a/common/pstore_commands.c b/common/pstore_commands.c index 9717d3ccdb..4b09c9bfcd 100644 --- a/common/pstore_commands.c +++ b/common/pstore_commands.c @@ -37,7 +37,7 @@ int pstore_command_read(struct host_cmd_handler_args *args) int offset = p->offset % block_size; int bytes_left = p->size; - if (p->size > sizeof(EC_PARAM_SIZE)) + if (p->size > args->response_max) return EC_RES_INVALID_PARAM; while (bytes_left) { |