[grilo-plugins] upnp: Prevent crash with some UPnP servers
- From: Juan A. Suarez Romero <jasuarez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins] upnp: Prevent crash with some UPnP servers
- Date: Thu, 20 Feb 2014 22:06:11 +0000 (UTC)
commit 61fce31b9dc9fc6b246f0cb533f62877ad509ed8
Author: Bastien Nocera <hadess hadess net>
Date: Thu Feb 20 12:42:02 2014 +0100
upnp: Prevent crash with some UPnP servers
The "Skifta" iOS UPnP server seems to pass us " " as a list
of changed items. We need to protect better against bad input and
avoid accessing data beyond the array.
https://bugzilla.gnome.org/show_bug.cgi?id=724793
src/upnp/grl-upnp.c | 23 ++++++++++++++++-------
1 files changed, 16 insertions(+), 7 deletions(-)
---
diff --git a/src/upnp/grl-upnp.c b/src/upnp/grl-upnp.c
index abe7567..a60631a 100644
--- a/src/upnp/grl-upnp.c
+++ b/src/upnp/grl-upnp.c
@@ -320,16 +320,25 @@ container_changed_cb (GUPnPServiceProxy *proxy,
tokens = g_strsplit (g_value_get_string (value), ",", -1);
changed_medias = g_ptr_array_sized_new (g_strv_length (tokens) / 2);
while (tokens[i]) {
- container = grl_media_box_new ();
- grl_media_set_id (container, tokens[i]);
- g_ptr_array_add (changed_medias, container);
+ gchar *token;
+
+ token = g_strstrip (tokens[i]);
+ if (token && *token != '\0') {
+ container = grl_media_box_new ();
+ grl_media_set_id (container, tokens[i]);
+ g_ptr_array_add (changed_medias, container);
+ }
i += 2;
+ if (i > g_strv_length (tokens))
+ break;
}
- grl_source_notify_change_list (source,
- changed_medias,
- GRL_CONTENT_CHANGED,
- FALSE);
+ if (changed_medias->len > 0) {
+ grl_source_notify_change_list (source,
+ changed_medias,
+ GRL_CONTENT_CHANGED,
+ FALSE);
+ }
g_strfreev (tokens);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]