Skip to content

Commit da0b80c

Browse files
committed
Fix not to assign null to strstr function
1 parent ec26bbe commit da0b80c

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

contrib/win32/win32compat/w32-doexec.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -469,12 +469,15 @@ int do_exec_windows(struct ssh *ssh, Session *s, const char *command, int pty) {
469469
}
470470

471471
//Passing the PRIVSEP_LOG_FD (STDERR_FILENO + 2) to sftp-server for logging
472-
if(strstr(exec_command, "sftp-server.exe"))
473-
if (posix_spawn_file_actions_adddup2(&actions, STDERR_FILENO + 2, SFTP_SERVER_LOG_FD) != 0) {
474-
errno = EOTHER;
475-
error("posix_spawn initialization failed");
476-
goto cleanup;
472+
if (command) {
473+
if (strstr(exec_command, "sftp-server.exe")) {
474+
if (posix_spawn_file_actions_adddup2(&actions, STDERR_FILENO + 2, SFTP_SERVER_LOG_FD) != 0) {
475+
errno = EOTHER;
476+
error("posix_spawn initialization failed");
477+
goto cleanup;
478+
}
477479
}
480+
}
478481

479482
if (posix_spawn(&pid, spawn_argv[0], &actions, NULL, spawn_argv, NULL) != 0) {
480483
errno = EOTHER;

0 commit comments

Comments
 (0)