client: check invalid params 55/171055/2
authorBoram Park <boram1288.park@samsung.com>
Mon, 26 Feb 2018 02:15:38 +0000 (11:15 +0900)
committerBoram Park <boram1288.park@samsung.com>
Mon, 26 Feb 2018 23:50:59 +0000 (08:50 +0900)
Change-Id: I637a30bb799589d359c8e9bfdafdec539a062717

client/tdm_client.c

index 468d984..a665eb1 100644 (file)
@@ -659,8 +659,14 @@ tdm_client_get_output(tdm_client *client, char *name, tdm_error *error)
                return NULL;
        }
 
-       if (!name)
+       if (!name) {
                name = "primary";
+       } else if (strncmp(name, "primary", 7) && strncmp(name, "default", 7)) {
+               if (error)
+                       *error = TDM_ERROR_INVALID_PARAMETER;
+               pthread_mutex_unlock(&private_client->lock);
+               return NULL;
+       }
 
        LIST_FOR_EACH_ENTRY(private_output, &private_client->output_list, link) {
                if (!strncmp(private_output->name, name, TDM_NAME_LEN)) {