From: Simon Glass Date: Sun, 23 Aug 2015 00:31:36 +0000 (-0600) Subject: tpm: Check that parse_byte_string() has data to parse X-Git-Tag: KARO-TX6-2015-09-18~18 X-Git-Url: https://git.kernelconcepts.de/?p=karo-tx-uboot.git;a=commitdiff_plain;h=f2276a63a7afdb2e14b9e833869d2a13e75bf269 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 Signed-off-by: Simon Glass Reviewed-by: Heiko Schocher --- 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;