[SATDEVKIT-2522]Security issues handled 86/197486/2 accepted/tizen/unified/20190115.060008 submit/tizen/20190114.083139
authoralkasethi <alka.sethi@samsung.com>
Fri, 11 Jan 2019 11:33:08 +0000 (17:03 +0530)
committeralkasethi <alka.sethi@samsung.com>
Fri, 11 Jan 2019 11:40:30 +0000 (17:10 +0530)
Change-Id: I41924e10ade8d96fcefa8adc053a12c0f6078a71
Signed-off-by: alkasethi <alka.sethi@samsung.com>
src/plugin.c
src/services.c

index 2e495e9..3c2533c 100644 (file)
@@ -388,9 +388,11 @@ int request_capability_to_plugin ( int cap, char* out_buf, unsigned int out_len
 
     ret = request_sync_cmd ( PLUGIN_SYNC_CMD_CAPABILITY, &in, &out );
     if ( ret == PLUGIN_CMD_SUCCESS ) {
-        strncpy ( out_buf, out.array_of_parameter[0].v_string.data, out_len - 1 );
-        out_buf[out_len - 1] = '\0';
-        success = 1;
+       if(out.array_of_parameter[0].v_string.data != NULL) {
+               strncpy ( out_buf, out.array_of_parameter[0].v_string.data, out_len - 1 );
+               out_buf[out_len - 1] = '\0';
+               success = 1;
+       }
         release_parameters ( &out );
 
         D ("request capability success : %s\n", out_buf);
@@ -501,9 +503,11 @@ int request_conversion_to_plugin ( int cmd, const char* in_buf, char* out_buf, u
 
     ret = request_sync_cmd ( cmd, &in, &out );
     if ( ret == PLUGIN_CMD_SUCCESS ) {
-        strncpy ( out_buf, out.array_of_parameter[0].v_string.data, out_len - 1 );
-        out_buf[out_len - 1] = '\0';
-        success = 1;
+       if(out.array_of_parameter[0].v_string.data != NULL) {
+               strncpy ( out_buf, out.array_of_parameter[0].v_string.data, out_len - 1 );
+               out_buf[out_len - 1] = '\0';
+               success = 1;
+       }
         release_parameters ( &out );
     }
 
@@ -539,9 +543,11 @@ int request_extcmd_conversion_to_plugin ( int cmd, const char* in_buf, char* out
 
     ret = plugin_sync_proc ( cmd, &in, &out );
     if ( ret == PLUGIN_CMD_SUCCESS ) {
-        strncpy ( out_buf, out.array_of_parameter[0].v_string.data, out_len - 1 );
-        out_buf[out_len - 1] = '\0';
-        success = 1;
+       if(out.array_of_parameter[0].v_string.data != NULL) {
+               strncpy ( out_buf, out.array_of_parameter[0].v_string.data, out_len - 1 );
+               out_buf[out_len - 1] = '\0';
+               success = 1;
+       }
         release_parameters ( &out );
     }
 
index 03e2751..db9148e 100644 (file)
@@ -1417,7 +1417,7 @@ int request_extcmd_to_plugin(const char* in_buf) {
         full_cmd[ENV_BUF_MAX - 1] = '\0';
     }
     else {
-        strcat(full_cmd, cmd_name);
+        strncat(full_cmd, cmd_name, strlen(cmd_name));
     }
 
     int i = 1;
@@ -1425,8 +1425,8 @@ int request_extcmd_to_plugin(const char* in_buf) {
         if (strlen(full_cmd) + strlen(tokens[i]) + 1 >= ENV_BUF_MAX) {
             break;
         }
-        strcat(full_cmd, " ");
-        strcat(full_cmd, tokens[i]);
+        strncat(full_cmd, " ",1);
+        strncat(full_cmd, tokens[i], strlen(tokens[i]));
     }
     D("full extcmd: %s\n", full_cmd);
     if (!strcmp(exec_type, "sync")) {