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>
diff --git a/common/cmd_tpm.c b/common/cmd_tpm.c
index 65e7371..e9c6618 100644
--- a/common/cmd_tpm.c
+++ b/common/cmd_tpm.c
@@ -58,6 +58,8 @@
size_t count, length;
int i;
+ if (!bytes)
+ return NULL;
length = strlen(bytes);
count = length / 2;