Эх сурвалжийг харах

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>
Simon Glass 9 жил өмнө
parent
commit
5c51d8aa0e
1 өөрчлөгдсөн 2 нэмэгдсэн , 0 устгасан
  1. 2 0
      common/cmd_tpm.c

+ 2 - 0
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;