check parameter before using strlen() 14/308514/5 accepted/tizen/unified/20240415.170316 accepted/tizen/unified/x/20240416.023013
authorhjkim <backto.kim@samsung.com>
Wed, 27 Mar 2024 01:35:58 +0000 (10:35 +0900)
committerhjkim <backto.kim@samsung.com>
Wed, 27 Mar 2024 02:14:47 +0000 (11:14 +0900)
Change-Id: Ideff7dbf3212c09653a3262f06b52a147eeece70

packaging/capi-media-controller.spec
test/client_test/media_controller_client_test.c
test/server_test/media_controller_server_test.c

index 72455ef..2df010e 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-controller
 Summary:    A media controller library in Tizen Native API
-Version:    0.2.45
+Version:    0.2.46
 Release:    1
 Group:      Multimedia/API
 License:    Apache-2.0
index 96490ea..35d50a0 100755 (executable)
@@ -1088,7 +1088,14 @@ static void __display_menu(void)
 
 static void __interpret_information_menu(char *cmd)
 {
-       int len = strlen(cmd);
+       int len;
+
+       if (!cmd) {
+               g_print("invalid command.\n");
+               return;
+       }
+
+       len = strlen(cmd);
 
        if (len == 1) {
                if (!strncmp(cmd, "1", len))
@@ -1118,7 +1125,14 @@ static void __interpret_information_menu(char *cmd)
 
 static void __interpret_main_menu(char *cmd)
 {
-       int len = strlen(cmd);
+       int len;
+
+       if (!cmd) {
+               g_print("invalid command.\n");
+               return;
+       }
+
+       len = strlen(cmd);
 
        if (len == 1) {
                if (!strncmp(cmd, "1", len))
index 08e24d0..d727cee 100755 (executable)
@@ -1108,7 +1108,14 @@ static void __display_menu(void)
 
 static void __interpret_update_info_menu(char *cmd)
 {
-       int len = strlen(cmd);
+       int len;
+
+       if (!cmd) {
+               g_print("invalid command.\n");
+               return;
+       }
+
+       len = strlen(cmd);
 
        if (len == 1 || len == 2) {
                if (!strncmp(cmd, "1", len))
@@ -1266,7 +1273,14 @@ static void __interpret_update_ability_menu(char *cmd)
 
 static void __interpret_set_info_menu(char *cmd)
 {
-       int len = strlen(cmd);
+       int len;
+
+       if (!cmd) {
+               g_print("invalid command.\n");
+               return;
+       }
+
+       len = strlen(cmd);
 
        if (len == 1) {
                if (!strncmp(cmd, "1", len))
@@ -1298,7 +1312,14 @@ static void __interpret_set_info_menu(char *cmd)
 
 static void __interpret_send_event_menu(char *cmd)
 {
-       int len = strlen(cmd);
+       int len;
+
+       if (!cmd) {
+               g_print("invalid command.\n");
+               return;
+       }
+
+       len = strlen(cmd);
 
        if (len == 1) {
                if (!strncmp(cmd, "1", len)) {
@@ -1326,7 +1347,14 @@ static void __interpret_send_event_menu(char *cmd)
 
 static void __interpret_main_menu(char *cmd)
 {
-       int len = strlen(cmd);
+       int len;
+
+       if (!cmd) {
+               g_print("invalid command.\n");
+               return;
+       }
+
+       len = strlen(cmd);
 
        if (len == 1) {
                if (!strncmp(cmd, "1", len))