From f381a43524a7f2e18e3002fa2c17ec61ab17f15c Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Wed, 16 May 2018 01:55:56 +0300 Subject: [PATCH] action-scripts: check a return code of get_service_fd >>> CID 190177: Integer handling issues (NEGATIVE_RETURNS) >>> rpc_sk is passed to a parameter that cannot be negative. Signed-off-by: Andrei Vagin --- criu/action-scripts.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/criu/action-scripts.c b/criu/action-scripts.c index 3cbe89ee4..7b78a1360 100644 --- a/criu/action-scripts.c +++ b/criu/action-scripts.c @@ -108,6 +108,8 @@ int rpc_send_fd(enum script_actions act, int fd) return -1; rpc_sk = get_service_fd(RPC_SK_OFF); + if (rpc_sk < 0) + return -1; pr_debug("\tRPC\n"); return send_criu_rpc_script(act, (char *)action, rpc_sk, fd); @@ -128,6 +130,10 @@ int run_scripts(enum script_actions act) pr_debug("\tRPC\n"); rpc_sk = get_service_fd(RPC_SK_OFF); + if (rpc_sk < 0) { + ret = -1; + goto out; + } ret = send_criu_rpc_script(act, (char *)action, rpc_sk, -1); goto out; }