[gnome-usage] system-monitor: Don't read argv beyond the boundary



commit 602c07c821a3ffd8c066da5ea489cabbeed0be07
Author: Mohammed Sadiq <sadiq sadiqpk org>
Date:   Thu May 11 08:18:02 2017 +0530

    system-monitor: Don't read argv beyond the boundary
    
    If there are no elements in argv, the first item could be itself null.
    And thus reading the next item is illegal. So break the loop once null is found.
    
    Also as both elements of secure_arguments are required to have some value
    insert a blank in case null is reached early.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=782487

 src/system-monitor.vala |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/src/system-monitor.vala b/src/system-monitor.vala
index 567fffa..6a6d363 100644
--- a/src/system-monitor.vala
+++ b/src/system-monitor.vala
@@ -230,9 +230,16 @@ namespace Usage
             for(int i = 0; i < 2; i++)
             {
                 if(args[i] != null)
+                {
                     secure_arguments[i] = args[i];
+                }
                 else
+                {
                     secure_arguments[i] = "";
+                    if (i == 0)
+                        secure_arguments[1] = "";
+                    break;
+                }
             }
 
             for (int i = 0; i < secure_arguments.length; i++)


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