From mboxrd@z Thu Jan 1 00:00:00 1970 From: christophe.ricard Date: Tue, 11 Aug 2015 23:42:38 +0200 Subject: [U-Boot] [PATCH 20/25] tpm: Check that parse_byte_string() has data to parse In-Reply-To: <1439304497-10081-21-git-send-email-sjg@chromium.org> References: <1439304497-10081-1-git-send-email-sjg@chromium.org> <1439304497-10081-21-git-send-email-sjg@chromium.org> Message-ID: <55CA6C4E.1030000@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Simon, Acked-by: Christophe Ricard Best Regards Christophe On 11/08/2015 16:48, Simon Glass wrote: > Rather then crashing when there is no data, print an error. > > Signed-off-by: Simon Glass > --- > > 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; >