[gupnp-av] Check for empty mandatory tags during UpdateObject



commit 12590c703bc210268fdebd4829666801bfacb32c
Author: Parthiban Balasubramanian <p balasubramanian cablelabs com>
Date:   Thu Jan 30 08:51:28 2014 -0700

    Check for empty mandatory tags during UpdateObject
    
    https://bugzilla.gnome.org/show_bug.cgi?id=705522

 libgupnp-av/fragment-util.c |   25 +++++++++++++++++++++++++
 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;
 


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