[gupnp] Fix a potential crash in case of a corrupted or malformed XML file.



commit fe9fb1863c295306063297bf7b38613efabd41bc
Author: Ludovic Ferrandis <ludovic ferrandis intel com>
Date:   Thu Jul 11 10:45:20 2013 +0200

    Fix a potential crash in case of a corrupted or malformed XML file.
    
    In icon_parse() function, icon->mime_type could be initialized to NULL.
    The call to strcmp could potentially crash.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=704094

 libgupnp/gupnp-device-info.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/libgupnp/gupnp-device-info.c b/libgupnp/gupnp-device-info.c
index b18f3ec..afdc6ce 100644
--- a/libgupnp/gupnp-device-info.c
+++ b/libgupnp/gupnp-device-info.c
@@ -751,9 +751,10 @@ gupnp_device_info_get_icon_url (GUPnPDeviceInfo *info,
                         icon = icon_parse (info, element);
 
                         if (requested_mime_type) {
-                                mime_type_ok =
-                                        !strcmp (requested_mime_type,
-                                                 (char *) icon->mime_type);
+                               if (icon->mime_type)
+                                       mime_type_ok = !strcmp (
+                                               requested_mime_type,
+                                               (char *) icon->mime_type);
                         } else
                                 mime_type_ok = TRUE;
 


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