summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorParthiban Balasubramanian <p.balasubramanian@cablelabs.com>2014-01-30 08:51:28 -0700
committerJens Georg <mail@jensge.org>2014-02-01 10:55:56 +0100
commit12590c703bc210268fdebd4829666801bfacb32c (patch)
tree519b0af3267659543860e4f8423b95aa3fedf5b3
parent57afc669233e8eea3cccfc363a4e97b938ba0b04 (diff)
downloadgupnp-av-12590c703bc210268fdebd4829666801bfacb32c.tar.gz
Check for empty mandatory tags during UpdateObject
https://bugzilla.gnome.org/show_bug.cgi?id=705522
-rw-r--r--libgupnp-av/fragment-util.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/libgupnp-av/fragment-util.c b/libgupnp-av/fragment-util.c
index 29deb08..ad15d53 100644
--- a/libgupnp-av/fragment-util.c
+++ b/libgupnp-av/fragment-util.c
@@ -710,6 +710,31 @@ fragment_util_check_fragments (DocNode *original,
goto out;
}
+ /* Assuming current_doc->children is non-NULL. */
+ if (current_doc->children != NULL &&
+ current_doc->children->children != NULL) {
+ /* If the child element is title or class,
+ * it must not be set to empty or removed.
+ */
+ if (g_strrstr (current_doc->children->children->name,
+ "title") != NULL ||
+ g_strrstr (current_doc->children->children->name,
+ "class") != NULL) {
+ /* If the new tag has no corresponding title or class element */
+ if (new_doc->children->children == NULL) {
+ result = GUPNP_DIDL_LITE_FRAGMENT_RESULT_REQUIRED_TAG;
+
+ goto out;
+ }
+ /* If the new tag has an empty value for title or class */
+ if (new_doc->children->children->children == NULL) {
+ result = GUPNP_DIDL_LITE_FRAGMENT_RESULT_REQUIRED_TAG;
+
+ goto out;
+ }
+ }
+ }
+
if (!is_current_doc_part_of_original_doc (original, current_doc)) {
result = GUPNP_DIDL_LITE_FRAGMENT_RESULT_CURRENT_INVALID;