device-manager: Add a sanity check for reading entries
authorTanu Kaskinen <tanu.kaskinen@linux.intel.com>
Tue, 4 Jun 2013 17:42:48 +0000 (20:42 +0300)
committerTanu Kaskinen <tanu.kaskinen@linux.intel.com>
Fri, 28 Jun 2013 06:58:07 +0000 (09:58 +0300)
There is code elsewhere that assumes that if user_set_description is
true, then the description is non-NULL.

src/modules/module-device-manager.c

index 47c78d4..8f1d9cd 100644 (file)
@@ -304,6 +304,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 NULL.");
+        goto fail;
+    }
+
     e->description = pa_xstrdup(description);
     e->icon = pa_xstrdup(icon);