From 46eec66b190470254fc01973f208dc056bcb9780 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 10 Jun 2018 19:03:00 +0200 Subject: [PATCH] don't ever set pointer outside of buffer even if it's not going to be used. Signed-off-by: Daniel Golle This work was sponsored by WIO (wiowireless.com) --- ucert.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ucert.c b/ucert.c index 686589f..6cdc220 100644 --- a/ucert.c +++ b/ucert.c @@ -172,9 +172,8 @@ static int cert_load(const char *certfile, struct list_head *chain) { list_add_tail(&cobj->list, chain); ret += pret; - bufpt = blob_next(bufpt); /* repeat parsing while there is still enough remaining data in buffer */ - } while(len > pos + sizeof(struct blob_attr)); + } while(len > pos + sizeof(struct blob_attr) && (bufpt = blob_next(bufpt))); return (ret <= 0); } -- 2.25.1