From 9d3ec971f3eea0605deebadf02a6179b90f936a0 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Mon, 28 Jan 2019 11:39:40 +0000 Subject: [PATCH] trivial: Never allow the content checksum filename to be NULL This prevents a critical warning from gcab_folder_get_file_by_name() --- src/fu-common-cab.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/fu-common-cab.c b/src/fu-common-cab.c index 22c7f7491..79e97b1f4 100644 --- a/src/fu-common-cab.c +++ b/src/fu-common-cab.c @@ -68,7 +68,7 @@ fu_common_store_from_cab_release (XbNode *release, GCabCabinet *cabinet, GError { GCabFile *cabfile; GBytes *blob; - const gchar *csum_filename; + const gchar *csum_filename = NULL; const gchar *suffixes[] = { "asc", "p7b", "p7c", NULL }; g_autofree gchar *basename = NULL; g_autofree gchar *release_key = NULL; @@ -77,14 +77,13 @@ fu_common_store_from_cab_release (XbNode *release, GCabCabinet *cabinet, GError /* ensure we always have a content checksum */ csum_tmp = xb_node_query_first (release, "checksum[@target='content']", NULL); - if (csum_tmp != NULL) { + if (csum_tmp != NULL) csum_filename = xb_node_get_attr (csum_tmp, "filename"); - } else { - /* if this isn't true, a firmware needs to set in - * the metainfo.xml file something like: - * */ + + /* if this isn't true, a firmware needs to set in the metainfo.xml file + * something like: */ + if (csum_filename == NULL) csum_filename = "firmware.bin"; - } /* get the main firmware file */ basename = g_path_get_basename (csum_filename);