summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2015-08-22 18:31:36 -0600
committerSimon Glass <sjg@chromium.org>2015-08-31 07:57:28 -0600
commit5c51d8aa0e87b0b057cf3aad6d57e89ba3aed933 (patch)
treec9e660dd5935f2c0766f70ed0cc3a41fdeb84106 /common
parent21baf15b4e638cf7719994fe6ac86e0d0e93aa78 (diff)
downloadtalos-obmc-uboot-5c51d8aa0e87b0b057cf3aad6d57e89ba3aed933.tar.gz
talos-obmc-uboot-5c51d8aa0e87b0b057cf3aad6d57e89ba3aed933.zip
tpm: Check that parse_byte_string() has data to parse
Rather then crashing when there is no data, print an error. The error is printed by the caller to parse_byte_string(). Acked-by: Christophe Ricard <christophe-h.ricard@st.com> Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heiko Schocher <hs@denx.de>
Diffstat (limited to 'common')
-rw-r--r--common/cmd_tpm.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/common/cmd_tpm.c b/common/cmd_tpm.c
index 65e7371e80..e9c661821c 100644
--- a/common/cmd_tpm.c
+++ b/common/cmd_tpm.c
@@ -58,6 +58,8 @@ static void *parse_byte_string(char *bytes, uint8_t *data, size_t *count_ptr)
size_t count, length;
int i;
+ if (!bytes)
+ return NULL;
length = strlen(bytes);
count = length / 2;
OpenPOWER on IntegriCloud