summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJett Rink <jettrink@chromium.org>2019-02-13 16:59:36 -0700
committerchrome-bot <chrome-bot@chromium.org>2019-02-14 05:27:30 -0800
commit16d77d2f44cf2c145625371c35f876931a00a552 (patch)
tree27b0cf21394123d8fe7998fb4692e8ae24cc168a
parent69e7d371ff0508740a506c9a9b52c03d35ae94cc (diff)
downloadchrome-ec-16d77d2f44cf2c145625371c35f876931a00a552.tar.gz
cleanup: do not try to copy to/from NULL
If we receive an unsupported protocol in the ISH, we should not try to dereference a NULL ptr. BRANCH=none BUG=none TEST=builds Change-Id: I4861385c30a94496026c1918d41a18ca82f3c740 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1470897 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
-rw-r--r--chip/ish/ipc_heci.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/chip/ish/ipc_heci.c b/chip/ish/ipc_heci.c
index 33e33f1717..e336994936 100644
--- a/chip/ish/ipc_heci.c
+++ b/chip/ish/ipc_heci.c
@@ -374,7 +374,8 @@ static int ipc_get_protocol_data(const struct ipc_if_ctx *ctx,
break;
}
- memcpy(dest, src, payload_size);
+ if (src && dest)
+ memcpy(dest, src, payload_size);
return len;
}