added maximum input length for sscanf 26/149526/1 accepted/tizen/4.0/unified/20170921.074252 submit/tizen_4.0/20170920.105822
authorYounho Park <younho.park@samsung.com>
Tue, 12 Sep 2017 10:54:58 +0000 (19:54 +0900)
committerYounho Park <younho.park@samsung.com>
Tue, 12 Sep 2017 10:54:58 +0000 (19:54 +0900)
Change-Id: Ic6afa413ad88d6962487a2957f6c2d432a6759dc
Signed-off-by: Younho Park <younho.park@samsung.com>
server/src/dbus/dbus-service-adaptor.c
server/src/dbus/dbus-storage-adaptor.c

index b843026..a6da042 100644 (file)
@@ -105,7 +105,7 @@ FUNC_STEP();
                service_adaptor_info("[DM] client profile <%s>", client_profile);
                char client_name[1024] = {0, };
                int client_pid = 0;
-               int sr = sscanf(client_profile, "%s%d", client_name, &client_pid);
+               int sr = sscanf(client_profile, "%1000s %10d", client_name, &client_pid);
                if (sr == 2) {
                                service_adaptor_info("[DM] client<%s> pid<%d>", client_name, client_pid);
                                #ifndef DETAILED_PEER
@@ -132,7 +132,7 @@ FUNC_END();
                service_adaptor_info("[DM] client profile <%s>", client_profile);
                char client_name[1024] = {0, };
                int client_pid = 0;
-               int sr = sscanf(client_profile, "%s%d", client_name, &client_pid);
+               int sr = sscanf(client_profile, "%1000s %10d", client_name, &client_pid);
                if (sr == 2) {
                                service_adaptor_info("[DM][dis] client<%s> pid<%d>", client_name, client_pid);
                                #ifndef DETAILED_PEER
index 0e589ca..da1fa29 100644 (file)
@@ -1278,7 +1278,7 @@ void storage_adaptor_method_call(GDBusConnection *connection,
                        char public_token[1024] = {0,};
                        char auth_code[1024] = {0,};
 
-                       sscanf(server_path, "%[^'?']?auth_code=%s", public_token, auth_code);
+                       sscanf(server_path, "%1000[^'?']?auth_code=%1000s", public_token, auth_code);
                        ret_code = storage_adaptor_download_file_sync_by_public_token(plugin, service->storage_context,
                                        public_token, auth_code, download_path, NULL, &error_code, NULL);
 
@@ -1354,7 +1354,7 @@ void storage_adaptor_method_call(GDBusConnection *connection,
                        char public_token[1024] = {0,};
                        char auth_code[1024] = {0,};
 
-                       sscanf(server_path, "%[^'?']?auth_code=%s", public_token, auth_code);
+                       sscanf(server_path, "%1000[^'?']?auth_code=%1000s", public_token, auth_code);
 
                        ret_code = storage_adaptor_download_file_async_by_public_token(plugin, service->storage_context,
                                        public_token, auth_code, download_path, NULL, (void *) &fd, &error_code);