From 259d262d39927203829fac0bbc05bd3772c01643 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Jos=C3=A9=20Bollo?= <jose.bollo@iot.bzh>
Date: Sat, 7 Jul 2018 18:13:39 +0200
Subject: [PATCH] wgtpkg-install: Fix SEGV when no icon in config file
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

Bug-AGL: SPEC-1573

Change-Id: I891c4edc3a7ded7848fe11cbc3ce3fe429650bf8
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
---
 src/wgtpkg-install.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/wgtpkg-install.c b/src/wgtpkg-install.c
index 9642c93..505b915 100644
--- a/src/wgtpkg-install.c
+++ b/src/wgtpkg-install.c
@@ -458,7 +458,7 @@ static int install_security(const struct wgt_desc *desc)
 	len--;
 	*head++ = '/';
 	icon = desc->icons ? desc->icons->src : NULL;
-	lic = (unsigned)strlen(icon);
+	lic = (unsigned)(icon ? strlen(icon) : 0);
 	n = file_count();
 	i = 0;
 	while(i < n) {
-- 
2.16.6