[gnome-software/wip/rancell/apt] Basic error checking of dpkg-deb's output



commit 8dbd736181da6fe9bc1a2f2082b490aa04ab1f43
Author: William Hua <william hua canonical com>
Date:   Thu Mar 3 16:20:55 2016 -0500

    Basic error checking of dpkg-deb's output

 src/plugins/gs-plugin-apt.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/src/plugins/gs-plugin-apt.c b/src/plugins/gs-plugin-apt.c
index afa9ced..fc1e5ac 100644
--- a/src/plugins/gs-plugin-apt.c
+++ b/src/plugins/gs-plugin-apt.c
@@ -879,6 +879,15 @@ gs_plugin_filename_to_app (GsPlugin      *plugin,
                return FALSE;
 
        tokens = g_strsplit (output, "\n", 0);
+
+       if (g_strv_length (tokens) < 5) {
+               g_set_error (error,
+                            GS_PLUGIN_ERROR,
+                            GS_PLUGIN_ERROR_FAILED,
+                            "dpkg-deb output format incorrect:\n\"%s\"\n", output);
+               return FALSE;
+       }
+
        description = g_strjoinv (NULL, tokens + 5);
 
        app = gs_app_new (tokens[0]);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]