Merge pull request #616 from ago-shi/test

Fix not to assign null to strstr function
This commit is contained in:
Vivian Thiebaut 2022-11-08 15:47:09 -05:00 committed by GitHub
commit f2ee7ea5fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 5 deletions

View File

@ -469,12 +469,15 @@ int do_exec_windows(struct ssh *ssh, Session *s, const char *command, int pty) {
}
//Passing the PRIVSEP_LOG_FD (STDERR_FILENO + 2) to sftp-server for logging
if(strstr(exec_command, "sftp-server.exe"))
if (posix_spawn_file_actions_adddup2(&actions, STDERR_FILENO + 2, SFTP_SERVER_LOG_FD) != 0) {
errno = EOTHER;
error("posix_spawn initialization failed");
goto cleanup;
if (exec_command) {
if (strstr(exec_command, "sftp-server.exe")) {
if (posix_spawn_file_actions_adddup2(&actions, STDERR_FILENO + 2, SFTP_SERVER_LOG_FD) != 0) {
errno = EOTHER;
error("posix_spawn initialization failed");
goto cleanup;
}
}
}
if (posix_spawn(&pid, spawn_argv[0], &actions, NULL, spawn_argv, NULL) != 0) {
errno = EOTHER;