resource-dbus: fix a buffer overflow.
authorIsmo Puustinen <ismo.puustinen@intel.com>
Wed, 11 Dec 2013 13:17:47 +0000 (15:17 +0200)
committerIsmo Puustinen <ismo.puustinen@intel.com>
Wed, 11 Dec 2013 13:19:30 +0000 (15:19 +0200)
src/plugins/plugin-resource-dbus.c

index ac2f403..c766af3 100644 (file)
@@ -922,7 +922,7 @@ static resource_set_o_t * create_rset(manager_o_t *mgr, uint32_t id,
             const char *sender)
 {
     char buf[MAX_PATH_LENGTH];
-    char resbuf[128];
+    char *resbuf[128];
     int ret;
     mrp_htbl_config_t resources_conf;
     resource_set_o_t *rset = NULL;
@@ -989,6 +989,9 @@ static resource_set_o_t * create_rset(manager_o_t *mgr, uint32_t id,
                 mrp_resource_definition_get_all_names(128,
                         (const char **) resbuf));
 
+    if (!available_resources_arr)
+        goto error;
+
     rset->available_resources_prop = create_property(mgr->ctx,
             rset->path, RSET_IFACE, "as", PROP_AVAILABLE_RESOURCES,
             available_resources_arr, free_string_array);