2015-03-20 13:56:04 +00:00
|
|
|
diff -up openssh-6.8p1/channels.c.coverity openssh-6.8p1/channels.c
|
|
|
|
--- openssh-6.8p1/channels.c.coverity 2015-03-18 17:21:51.815265002 +0100
|
|
|
|
+++ openssh-6.8p1/channels.c 2015-03-18 17:21:51.896264833 +0100
|
|
|
|
@@ -243,11 +243,11 @@ channel_register_fds(Channel *c, int rfd
|
2011-09-08 22:54:28 +00:00
|
|
|
channel_max_fd = MAX(channel_max_fd, wfd);
|
|
|
|
channel_max_fd = MAX(channel_max_fd, efd);
|
|
|
|
|
|
|
|
- if (rfd != -1)
|
|
|
|
+ if (rfd >= 0)
|
|
|
|
fcntl(rfd, F_SETFD, FD_CLOEXEC);
|
|
|
|
- if (wfd != -1 && wfd != rfd)
|
|
|
|
+ if (wfd >= 0 && wfd != rfd)
|
|
|
|
fcntl(wfd, F_SETFD, FD_CLOEXEC);
|
|
|
|
- if (efd != -1 && efd != rfd && efd != wfd)
|
|
|
|
+ if (efd >= 0 && efd != rfd && efd != wfd)
|
|
|
|
fcntl(efd, F_SETFD, FD_CLOEXEC);
|
|
|
|
|
|
|
|
c->rfd = rfd;
|
2015-03-20 13:56:04 +00:00
|
|
|
@@ -265,11 +265,11 @@ channel_register_fds(Channel *c, int rfd
|
2011-09-08 22:54:28 +00:00
|
|
|
|
|
|
|
/* enable nonblocking mode */
|
|
|
|
if (nonblock) {
|
|
|
|
- if (rfd != -1)
|
|
|
|
+ if (rfd >= 0)
|
|
|
|
set_nonblock(rfd);
|
|
|
|
- if (wfd != -1)
|
|
|
|
+ if (wfd >= 0)
|
|
|
|
set_nonblock(wfd);
|
|
|
|
- if (efd != -1)
|
|
|
|
+ if (efd >= 0)
|
|
|
|
set_nonblock(efd);
|
|
|
|
}
|
|
|
|
}
|
2015-03-20 13:56:04 +00:00
|
|
|
diff -up openssh-6.8p1/monitor.c.coverity openssh-6.8p1/monitor.c
|
|
|
|
--- openssh-6.8p1/monitor.c.coverity 2015-03-18 17:21:51.887264852 +0100
|
|
|
|
+++ openssh-6.8p1/monitor.c 2015-03-18 17:21:51.897264831 +0100
|
|
|
|
@@ -444,7 +444,7 @@ monitor_child_preauth(Authctxt *_authctx
|
2013-04-04 14:42:32 +00:00
|
|
|
mm_get_keystate(pmonitor);
|
2011-09-14 15:03:03 +00:00
|
|
|
|
|
|
|
/* Drain any buffered messages from the child */
|
|
|
|
- while (pmonitor->m_log_recvfd != -1 && monitor_read_log(pmonitor) == 0)
|
|
|
|
+ while (pmonitor->m_log_recvfd >= 0 && monitor_read_log(pmonitor) == 0)
|
|
|
|
;
|
|
|
|
|
2013-04-04 14:42:32 +00:00
|
|
|
close(pmonitor->m_sendfd);
|
2015-03-20 13:56:04 +00:00
|
|
|
diff -up openssh-6.8p1/monitor_wrap.c.coverity openssh-6.8p1/monitor_wrap.c
|
|
|
|
--- openssh-6.8p1/monitor_wrap.c.coverity 2015-03-18 17:21:51.888264849 +0100
|
|
|
|
+++ openssh-6.8p1/monitor_wrap.c 2015-03-18 17:21:51.897264831 +0100
|
|
|
|
@@ -533,10 +533,10 @@ mm_pty_allocate(int *ptyfd, int *ttyfd,
|
2011-09-14 15:03:03 +00:00
|
|
|
if ((tmp1 = dup(pmonitor->m_recvfd)) == -1 ||
|
|
|
|
(tmp2 = dup(pmonitor->m_recvfd)) == -1) {
|
|
|
|
error("%s: cannot allocate fds for pty", __func__);
|
|
|
|
- if (tmp1 > 0)
|
|
|
|
+ if (tmp1 >= 0)
|
|
|
|
close(tmp1);
|
|
|
|
- if (tmp2 > 0)
|
|
|
|
- close(tmp2);
|
|
|
|
+ /*DEAD CODE if (tmp2 >= 0)
|
|
|
|
+ close(tmp2);*/
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
close(tmp1);
|
2015-03-20 13:56:04 +00:00
|
|
|
diff -up openssh-6.8p1/openbsd-compat/bindresvport.c.coverity openssh-6.8p1/openbsd-compat/bindresvport.c
|
|
|
|
--- openssh-6.8p1/openbsd-compat/bindresvport.c.coverity 2015-03-17 06:49:20.000000000 +0100
|
|
|
|
+++ openssh-6.8p1/openbsd-compat/bindresvport.c 2015-03-18 17:21:51.897264831 +0100
|
|
|
|
@@ -58,7 +58,7 @@ bindresvport_sa(int sd, struct sockaddr
|
2011-09-09 19:18:35 +00:00
|
|
|
struct sockaddr_in6 *in6;
|
|
|
|
u_int16_t *portp;
|
|
|
|
u_int16_t port;
|
|
|
|
- socklen_t salen;
|
|
|
|
+ socklen_t salen = sizeof(struct sockaddr_storage);
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (sa == NULL) {
|
2015-03-20 13:56:04 +00:00
|
|
|
diff -up openssh-6.8p1/scp.c.coverity openssh-6.8p1/scp.c
|
|
|
|
--- openssh-6.8p1/scp.c.coverity 2015-03-18 17:21:51.868264891 +0100
|
|
|
|
+++ openssh-6.8p1/scp.c 2015-03-18 17:21:58.281251460 +0100
|
|
|
|
@@ -156,7 +156,7 @@ killchild(int signo)
|
2011-09-08 22:54:28 +00:00
|
|
|
{
|
|
|
|
if (do_cmd_pid > 1) {
|
|
|
|
kill(do_cmd_pid, signo ? signo : SIGTERM);
|
|
|
|
- waitpid(do_cmd_pid, NULL, 0);
|
|
|
|
+ (void) waitpid(do_cmd_pid, NULL, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (signo)
|
2015-03-20 13:56:04 +00:00
|
|
|
diff -up openssh-6.8p1/servconf.c.coverity openssh-6.8p1/servconf.c
|
|
|
|
--- openssh-6.8p1/servconf.c.coverity 2015-03-18 17:21:51.893264839 +0100
|
|
|
|
+++ openssh-6.8p1/servconf.c 2015-03-18 17:21:58.281251460 +0100
|
|
|
|
@@ -1475,7 +1475,7 @@ process_server_config_line(ServerOptions
|
2011-09-09 19:18:35 +00:00
|
|
|
fatal("%s line %d: Missing subsystem name.",
|
|
|
|
filename, linenum);
|
|
|
|
if (!*activep) {
|
|
|
|
- arg = strdelim(&cp);
|
|
|
|
+ /*arg =*/ (void) strdelim(&cp);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
for (i = 0; i < options->num_subsystems; i++)
|
2015-03-20 13:56:04 +00:00
|
|
|
@@ -1566,8 +1566,9 @@ process_server_config_line(ServerOptions
|
2011-09-14 15:03:03 +00:00
|
|
|
if (*activep && *charptr == NULL) {
|
|
|
|
*charptr = tilde_expand_filename(arg, getuid());
|
|
|
|
/* increase optional counter */
|
|
|
|
- if (intptr != NULL)
|
|
|
|
- *intptr = *intptr + 1;
|
|
|
|
+ /* DEAD CODE intptr is still NULL ;)
|
|
|
|
+ if (intptr != NULL)
|
|
|
|
+ *intptr = *intptr + 1; */
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2015-03-20 13:56:04 +00:00
|
|
|
diff -up openssh-6.8p1/serverloop.c.coverity openssh-6.8p1/serverloop.c
|
|
|
|
--- openssh-6.8p1/serverloop.c.coverity 2015-03-17 06:49:20.000000000 +0100
|
|
|
|
+++ openssh-6.8p1/serverloop.c 2015-03-18 17:28:45.616436080 +0100
|
2011-09-08 22:54:28 +00:00
|
|
|
@@ -147,13 +147,13 @@ notify_setup(void)
|
|
|
|
static void
|
|
|
|
notify_parent(void)
|
|
|
|
{
|
|
|
|
- if (notify_pipe[1] != -1)
|
|
|
|
+ if (notify_pipe[1] >= 0)
|
2013-10-14 13:54:41 +00:00
|
|
|
(void)write(notify_pipe[1], "", 1);
|
2011-09-08 22:54:28 +00:00
|
|
|
}
|
|
|
|
static void
|
|
|
|
notify_prepare(fd_set *readset)
|
|
|
|
{
|
|
|
|
- if (notify_pipe[0] != -1)
|
|
|
|
+ if (notify_pipe[0] >= 0)
|
|
|
|
FD_SET(notify_pipe[0], readset);
|
|
|
|
}
|
|
|
|
static void
|
|
|
|
@@ -161,8 +161,8 @@ notify_done(fd_set *readset)
|
|
|
|
{
|
|
|
|
char c;
|
|
|
|
|
|
|
|
- if (notify_pipe[0] != -1 && FD_ISSET(notify_pipe[0], readset))
|
|
|
|
- while (read(notify_pipe[0], &c, 1) != -1)
|
|
|
|
+ if (notify_pipe[0] >= 0 && FD_ISSET(notify_pipe[0], readset))
|
|
|
|
+ while (read(notify_pipe[0], &c, 1) >= 0)
|
|
|
|
debug2("notify_done: reading");
|
|
|
|
}
|
|
|
|
|
2015-03-20 13:56:04 +00:00
|
|
|
@@ -337,7 +337,7 @@ wait_until_can_do_something(fd_set **rea
|
2011-09-08 22:54:28 +00:00
|
|
|
* If we have buffered data, try to write some of that data
|
|
|
|
* to the program.
|
|
|
|
*/
|
|
|
|
- if (fdin != -1 && buffer_len(&stdin_buffer) > 0)
|
|
|
|
+ if (fdin >= 0 && buffer_len(&stdin_buffer) > 0)
|
|
|
|
FD_SET(fdin, *writesetp);
|
|
|
|
}
|
|
|
|
notify_prepare(*readsetp);
|
2014-11-13 15:43:15 +00:00
|
|
|
@@ -477,7 +477,7 @@ process_output(fd_set *writeset)
|
2011-09-08 22:54:28 +00:00
|
|
|
int len;
|
|
|
|
|
|
|
|
/* Write buffered data to program stdin. */
|
|
|
|
- if (!compat20 && fdin != -1 && FD_ISSET(fdin, writeset)) {
|
|
|
|
+ if (!compat20 && fdin >= 0 && FD_ISSET(fdin, writeset)) {
|
|
|
|
data = buffer_ptr(&stdin_buffer);
|
|
|
|
dlen = buffer_len(&stdin_buffer);
|
|
|
|
len = write(fdin, data, dlen);
|
2015-03-20 13:56:04 +00:00
|
|
|
@@ -590,7 +590,7 @@ server_loop(pid_t pid, int fdin_arg, int
|
2011-09-08 22:54:28 +00:00
|
|
|
set_nonblock(fdin);
|
|
|
|
set_nonblock(fdout);
|
|
|
|
/* we don't have stderr for interactive terminal sessions, see below */
|
|
|
|
- if (fderr != -1)
|
|
|
|
+ if (fderr >= 0)
|
|
|
|
set_nonblock(fderr);
|
|
|
|
|
|
|
|
if (!(datafellows & SSH_BUG_IGNOREMSG) && isatty(fdin))
|
2015-03-20 13:56:04 +00:00
|
|
|
@@ -614,7 +614,7 @@ server_loop(pid_t pid, int fdin_arg, int
|
2011-09-08 22:54:28 +00:00
|
|
|
max_fd = MAX(connection_in, connection_out);
|
|
|
|
max_fd = MAX(max_fd, fdin);
|
|
|
|
max_fd = MAX(max_fd, fdout);
|
|
|
|
- if (fderr != -1)
|
|
|
|
+ if (fderr >= 0)
|
|
|
|
max_fd = MAX(max_fd, fderr);
|
|
|
|
#endif
|
|
|
|
|
2015-03-20 13:56:04 +00:00
|
|
|
@@ -644,7 +644,7 @@ server_loop(pid_t pid, int fdin_arg, int
|
2011-09-08 22:54:28 +00:00
|
|
|
* If we have received eof, and there is no more pending
|
|
|
|
* input data, cause a real eof by closing fdin.
|
|
|
|
*/
|
|
|
|
- if (stdin_eof && fdin != -1 && buffer_len(&stdin_buffer) == 0) {
|
|
|
|
+ if (stdin_eof && fdin >= 0 && buffer_len(&stdin_buffer) == 0) {
|
|
|
|
if (fdin != fdout)
|
|
|
|
close(fdin);
|
|
|
|
else
|
2015-03-20 13:56:04 +00:00
|
|
|
@@ -740,15 +740,15 @@ server_loop(pid_t pid, int fdin_arg, int
|
2011-09-08 22:54:28 +00:00
|
|
|
buffer_free(&stderr_buffer);
|
|
|
|
|
|
|
|
/* Close the file descriptors. */
|
|
|
|
- if (fdout != -1)
|
|
|
|
+ if (fdout >= 0)
|
|
|
|
close(fdout);
|
|
|
|
fdout = -1;
|
|
|
|
fdout_eof = 1;
|
|
|
|
- if (fderr != -1)
|
|
|
|
+ if (fderr >= 0)
|
|
|
|
close(fderr);
|
|
|
|
fderr = -1;
|
|
|
|
fderr_eof = 1;
|
|
|
|
- if (fdin != -1)
|
|
|
|
+ if (fdin >= 0)
|
|
|
|
close(fdin);
|
|
|
|
fdin = -1;
|
|
|
|
|
2015-03-20 13:56:04 +00:00
|
|
|
@@ -950,7 +950,7 @@ server_input_window_size(int type, u_int
|
2011-09-08 22:54:28 +00:00
|
|
|
|
|
|
|
debug("Window change received.");
|
|
|
|
packet_check_eom();
|
|
|
|
- if (fdin != -1)
|
|
|
|
+ if (fdin >= 0)
|
|
|
|
pty_change_window_size(fdin, row, col, xpixel, ypixel);
|
2015-03-20 13:56:04 +00:00
|
|
|
return 0;
|
2011-09-08 22:54:28 +00:00
|
|
|
}
|
2015-03-20 13:56:04 +00:00
|
|
|
@@ -1043,7 +1043,7 @@ server_request_tun(void)
|
2011-09-08 22:54:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
tun = packet_get_int();
|
|
|
|
- if (forced_tun_device != -1) {
|
|
|
|
+ if (forced_tun_device >= 0) {
|
|
|
|
if (tun != SSH_TUNID_ANY && forced_tun_device != tun)
|
|
|
|
goto done;
|
|
|
|
tun = forced_tun_device;
|
2015-03-20 13:56:04 +00:00
|
|
|
diff -up openssh-6.8p1/sftp.c.coverity openssh-6.8p1/sftp.c
|
|
|
|
--- openssh-6.8p1/sftp.c.coverity 2015-03-17 06:49:20.000000000 +0100
|
|
|
|
+++ openssh-6.8p1/sftp.c 2015-03-18 17:21:58.283251456 +0100
|
|
|
|
@@ -223,7 +223,7 @@ killchild(int signo)
|
2013-10-14 13:54:41 +00:00
|
|
|
{
|
|
|
|
if (sshpid > 1) {
|
|
|
|
kill(sshpid, SIGTERM);
|
|
|
|
- waitpid(sshpid, NULL, 0);
|
|
|
|
+ (void) waitpid(sshpid, NULL, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
_exit(1);
|
2015-03-20 13:56:04 +00:00
|
|
|
diff -up openssh-6.8p1/ssh-agent.c.coverity openssh-6.8p1/ssh-agent.c
|
|
|
|
--- openssh-6.8p1/ssh-agent.c.coverity 2015-03-17 06:49:20.000000000 +0100
|
|
|
|
+++ openssh-6.8p1/ssh-agent.c 2015-03-18 17:21:58.284251454 +0100
|
|
|
|
@@ -1166,8 +1166,8 @@ main(int ac, char **av)
|
2011-09-09 19:18:35 +00:00
|
|
|
sanitise_stdfd();
|
|
|
|
|
|
|
|
/* drop */
|
|
|
|
- setegid(getgid());
|
|
|
|
- setgid(getgid());
|
|
|
|
+ (void) setegid(getgid());
|
|
|
|
+ (void) setgid(getgid());
|
|
|
|
|
2016-07-25 14:21:15 +00:00
|
|
|
platform_disable_tracing(0); /* strict=no */
|
|
|
|
|
2015-03-20 13:56:04 +00:00
|
|
|
diff -up openssh-6.8p1/sshd.c.coverity openssh-6.8p1/sshd.c
|
|
|
|
--- openssh-6.8p1/sshd.c.coverity 2015-03-18 17:21:51.893264839 +0100
|
|
|
|
+++ openssh-6.8p1/sshd.c 2015-03-18 17:21:58.284251454 +0100
|
|
|
|
@@ -778,8 +778,10 @@ privsep_preauth(Authctxt *authctxt)
|
2016-02-19 13:42:33 +00:00
|
|
|
|
|
|
|
privsep_preauth_child();
|
2011-09-14 15:03:03 +00:00
|
|
|
setproctitle("%s", "[net]");
|
|
|
|
- if (box != NULL)
|
|
|
|
+ if (box != NULL) {
|
|
|
|
ssh_sandbox_child(box);
|
2013-10-14 13:54:41 +00:00
|
|
|
+ free(box);
|
2011-09-14 15:03:03 +00:00
|
|
|
+ }
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2015-03-20 13:56:04 +00:00
|
|
|
@@ -1518,6 +1520,9 @@ server_accept_loop(int *sock_in, int *so
|
2011-09-08 22:54:28 +00:00
|
|
|
if (num_listen_socks < 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ if (fdset != NULL)
|
2013-10-14 13:54:41 +00:00
|
|
|
+ free(fdset);
|
2011-09-08 22:54:28 +00:00
|
|
|
}
|
|
|
|
|
2016-07-25 14:21:15 +00:00
|
|
|
/*
|