diff options
author | Richard Hughes <richard@hughsie.com> | 2015-03-04 15:00:39 +0000 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2015-03-04 15:00:39 +0000 |
commit | 316be2242a46b4526f6fec316825a1769935602e (patch) | |
tree | cd8ee33f36540a97bfc08b1faba2ec811768f482 | |
parent | f8642889bc5e179126bef3f33dcfb163e0bd0ef7 (diff) | |
download | appstream-glib-316be2242a46b4526f6fec316825a1769935602e.tar.gz |
trivial: Fix up two .inf parsing issues
-rw-r--r-- | libappstream-builder/plugins/asb-plugin-firmware.c | 7 | ||||
-rw-r--r-- | libappstream-glib/as-utils.c | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/libappstream-builder/plugins/asb-plugin-firmware.c b/libappstream-builder/plugins/asb-plugin-firmware.c index d0da399..13fe9f6 100644 --- a/libappstream-builder/plugins/asb-plugin-firmware.c +++ b/libappstream-builder/plugins/asb-plugin-firmware.c @@ -186,6 +186,13 @@ asb_plugin_process_filename (AsbPlugin *plugin, /* parse */ class = g_key_file_get_string (kf, "Version", "Class", NULL); + if (class == NULL) { + g_set_error_literal (error, + ASB_PLUGIN_ERROR, + ASB_PLUGIN_ERROR_NOT_SUPPORTED, + "Driver class is missing"); + return FALSE; + } if (g_strcmp0 (class, "Firmware") != 0) { g_set_error (error, ASB_PLUGIN_ERROR, diff --git a/libappstream-glib/as-utils.c b/libappstream-glib/as-utils.c index 82c4067..631dd96 100644 --- a/libappstream-glib/as-utils.c +++ b/libappstream-glib/as-utils.c @@ -1602,7 +1602,7 @@ as_utils_load_inf_file (const gchar *filename, GError **error) } /* is valid section header */ - if (g_strstr_len (lines[i], -1, "[") != NULL && + if (g_str_has_prefix (lines[i], "[") && g_strstr_len (lines[i], -1, "]") != NULL) { lines_fixed[idx++] = g_strdup (lines[i]); nokey_idx = 0; |