device-manager: Refuse to load empty descriptions
authorTanu Kaskinen <tanu.kaskinen@linux.intel.com>
Tue, 2 Jul 2013 14:46:11 +0000 (17:46 +0300)
committerTanu Kaskinen <tanu.kaskinen@linux.intel.com>
Tue, 2 Jul 2013 14:49:17 +0000 (17:49 +0300)
src/modules/module-device-manager.c

index 8f1d9cd..f578502 100644 (file)
@@ -263,6 +263,11 @@ static struct entry* legacy_entry_read(struct userdata *u, pa_datum *data) {
         return NULL;
     }
 
+    if (!le->description[0]) {
+        pa_log_warn("Description is empty.");
+        return NULL;
+    }
+
     if (!memchr(le->icon, 0, sizeof(le->icon))) {
         pa_log_warn("Icon has missing NUL byte.");
         return NULL;
@@ -309,6 +314,11 @@ static struct entry* entry_read(struct userdata *u, const char *name) {
         goto fail;
     }
 
+    if (e->user_set_description && !*description) {
+        pa_log("Entry has user_set_description set, but the description is empty.");
+        goto fail;
+    }
+
     e->description = pa_xstrdup(description);
     e->icon = pa_xstrdup(icon);