[U-Boot] [PATCH 20/25] tpm: Check that parse_byte_string() has data to parse

Simon Glass sjg at chromium.org
Tue Aug 11 16:48:12 CEST 2015


Rather then crashing when there is no data, print an error.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 common/cmd_tpm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/common/cmd_tpm.c b/common/cmd_tpm.c
index f48ab04..2783895 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;
 
-- 
2.5.0.rc2.392.g76e840b



More information about the U-Boot mailing list