Просмотр исходного кода

coroipcs: Deny connect to service without initfn

If library connect to service with no init function, coroipcs will try
to dereference NULL pointer. Now we correctly return error code
CS_ERR_NOT_EXIST.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
(cherry picked from commit 719fddd8e16b6da8694fa84dd2fafbb202401200)
Jan Friesse 15 лет назад
Родитель
Сommit
4ddaf491d5
1 измененных файлов с 3 добавлено и 2 удалено
  1. 3 2
      exec/coroipcs.c

+ 3 - 2
exec/coroipcs.c

@@ -1622,13 +1622,14 @@ int coroipcs_handler_dispatch (
 		req_setup = (mar_req_setup_t *)conn_info->setup_msg;
 		/*
 		 * Is the service registered ?
+		 * Has service init function ?
 		 */
-		if (api->service_available (req_setup->service) == 0) {
+		if (api->service_available (req_setup->service) == 0 ||
+		    api->init_fn_get (req_setup->service) == NULL) {
 			req_setup_send (conn_info, CS_ERR_NOT_EXIST);
 			ipc_disconnect (conn_info);
 			return (0);
 		}
-
 #if _POSIX_THREAD_PROCESS_SHARED < 1
 		conn_info->semkey = req_setup->semkey;
 #endif