[gnome-boxes] Don't crash on missing udev properties



commit 34cbb6c47655a8a03979a6a9f4bbbc5ca47498c9
Author: Christophe Fergeau <cfergeau redhat com>
Date:   Thu Mar 28 11:24:26 2013 +0100

    Don't crash on missing udev properties
    
    32001c4 added support for new udev properties added in recent udev
    versions that are meant to replace the deprecated OSINFO_ properties.
    However get_decoded_udev_property() is not dealing properly with
    missing udev properties, and tries to call strlen() on a NULL string
    when this happens, causing a crash.
    
    This should fix rhbz#928495
    
    https://bugzilla.gnome.org/show_bug.cgi?id=696763

 src/installer-media.vala |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/src/installer-media.vala b/src/installer-media.vala
index 51e9bbe..7791085 100644
--- a/src/installer-media.vala
+++ b/src/installer-media.vala
@@ -191,6 +191,8 @@ private class Boxes.InstallerMedia : GLib.Object {
 
     private string? get_decoded_udev_property (GUdev.Device device, string property_name) {
         var encoded = device.get_property (property_name);
+        if (!encoded)
+            return null;
 
         var decoded = "";
         for (var i = 0; i < encoded.length; ) {


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