comparison cli-main.c @ 1256:506f7681d0f8 coverity

merge up to date
author Matt Johnston <matt@ucc.asn.au>
date Tue, 15 Mar 2016 22:45:43 +0800
parents f7d565054e5f
children 750ec4ec4cbe b66a483f3dcb
comparison
equal deleted inserted replaced
1219:84cf9062718d 1256:506f7681d0f8
150 dropbear_exit("Failed to run '%s'\n", cmd); 150 dropbear_exit("Failed to run '%s'\n", cmd);
151 } 151 }
152 152
153 #ifdef ENABLE_CLI_PROXYCMD 153 #ifdef ENABLE_CLI_PROXYCMD
154 static void cli_proxy_cmd(int *sock_in, int *sock_out, pid_t *pid_out) { 154 static void cli_proxy_cmd(int *sock_in, int *sock_out, pid_t *pid_out) {
155 char * ex_cmd = NULL;
156 size_t ex_cmdlen;
155 int ret; 157 int ret;
156 158
157 fill_passwd(cli_opts.own_user); 159 fill_passwd(cli_opts.own_user);
158 160
159 ret = spawn_command(exec_proxy_cmd, cli_opts.proxycmd, 161 ex_cmdlen = strlen(cli_opts.proxycmd) + 6; /* "exec " + command + '\0' */
162 ex_cmd = m_malloc(ex_cmdlen);
163 snprintf(ex_cmd, ex_cmdlen, "exec %s", cli_opts.proxycmd);
164
165 ret = spawn_command(exec_proxy_cmd, ex_cmd,
160 sock_out, sock_in, NULL, pid_out); 166 sock_out, sock_in, NULL, pid_out);
167 m_free(ex_cmd);
161 if (ret == DROPBEAR_FAILURE) { 168 if (ret == DROPBEAR_FAILURE) {
162 dropbear_exit("Failed running proxy command"); 169 dropbear_exit("Failed running proxy command");
163 *sock_in = *sock_out = -1; 170 *sock_in = *sock_out = -1;
164 } 171 }
165 } 172 }