summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/system_common.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/common/system_common.c b/common/system_common.c
index e88a377b63..847e808fd2 100644
--- a/common/system_common.c
+++ b/common/system_common.c
@@ -776,9 +776,12 @@ DECLARE_HOST_COMMAND(EC_CMD_GET_VERSION,
static int host_command_build_info(struct host_cmd_handler_args *args)
{
const char *info = system_get_build_info();
+ int len;
- args->response = (uint8_t *)info;
- args->response_size = strlen(info) + 1;
+ len = MIN(strlen(info), args->response_max - 1);
+ args->response_size = args->response_max;
+ memcpy(args->response, info, len);
+ memset(args->response + len, 0, args->response_size - len);
return EC_RES_SUCCESS;
}