From 206b3db9f10bbc476ae5f2514b7e3f51f0552f6c Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Mon, 12 Feb 2018 15:04:22 +0000 Subject: [PATCH 1/2] client: Fix a potential NULL pointer dereference If there are no profiles. Coverity CID: 1453715. Signed-off-by: Philip Withnall https://bugs.freedesktop.org/show_bug.cgi?id=105061 --- client/cd-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/cd-util.c b/client/cd-util.c index 2b88ec2..737dd1c 100644 --- a/client/cd-util.c +++ b/client/cd-util.c @@ -350,7 +350,7 @@ cd_util_show_device (CdUtilPrivate *priv, CdDevice *device) /* print profiles */ profiles = cd_device_get_profiles (device); - for (i = 0; i < profiles->len; i++) { + for (i = 0; profiles != NULL && i < profiles->len; i++) { profile_tmp = g_ptr_array_index (profiles, i); /* TRANSLATORS: the profile for the device */ str_tmp = g_strdup_printf ("%s %u", _("Profile"), i+1); -- 2.14.3