aaf34e5
diff -up openssh-6.3p1/auth-pam.c.coverity openssh-6.3p1/auth-pam.c
aaf34e5
--- openssh-6.3p1/auth-pam.c.coverity	2013-06-02 00:07:32.000000000 +0200
aaf34e5
+++ openssh-6.3p1/auth-pam.c	2013-10-07 13:20:36.288298063 +0200
99254d5
@@ -216,7 +216,12 @@ pthread_join(sp_pthread_t thread, void *
99254d5
 	if (sshpam_thread_status != -1)
99254d5
 		return (sshpam_thread_status);
99254d5
 	signal(SIGCHLD, sshpam_oldsig);
99254d5
-	waitpid(thread, &status, 0);
99254d5
+	while (waitpid(thread, &status, 0) < 0) {                     
99254d5
+		if (errno == EINTR)                                
99254d5
+			continue;
99254d5
+		fatal("%s: waitpid: %s", __func__,         
99254d5
+				strerror(errno));                      
99254d5
+	}
99254d5
 	return (status);
99254d5
 }
99254d5
 #endif
aaf34e5
diff -up openssh-6.3p1/channels.c.coverity openssh-6.3p1/channels.c
aaf34e5
--- openssh-6.3p1/channels.c.coverity	2013-09-13 08:19:31.000000000 +0200
aaf34e5
+++ openssh-6.3p1/channels.c	2013-10-07 13:20:36.289298058 +0200
aaf34e5
@@ -233,11 +233,11 @@ channel_register_fds(Channel *c, int rfd
99254d5
 	channel_max_fd = MAX(channel_max_fd, wfd);
99254d5
 	channel_max_fd = MAX(channel_max_fd, efd);
99254d5
 
99254d5
-	if (rfd != -1)
99254d5
+	if (rfd >= 0)
99254d5
 		fcntl(rfd, F_SETFD, FD_CLOEXEC);
99254d5
-	if (wfd != -1 && wfd != rfd)
99254d5
+	if (wfd >= 0 && wfd != rfd)
99254d5
 		fcntl(wfd, F_SETFD, FD_CLOEXEC);
99254d5
-	if (efd != -1 && efd != rfd && efd != wfd)
99254d5
+	if (efd >= 0 && efd != rfd && efd != wfd)
99254d5
 		fcntl(efd, F_SETFD, FD_CLOEXEC);
99254d5
 
99254d5
 	c->rfd = rfd;
aaf34e5
@@ -255,11 +255,11 @@ channel_register_fds(Channel *c, int rfd
99254d5
 
99254d5
 	/* enable nonblocking mode */
99254d5
 	if (nonblock) {
99254d5
-		if (rfd != -1)
99254d5
+		if (rfd >= 0)
99254d5
 			set_nonblock(rfd);
99254d5
-		if (wfd != -1)
99254d5
+		if (wfd >= 0)
99254d5
 			set_nonblock(wfd);
99254d5
-		if (efd != -1)
99254d5
+		if (efd >= 0)
99254d5
 			set_nonblock(efd);
99254d5
 	}
99254d5
 }
aaf34e5
diff -up openssh-6.3p1/clientloop.c.coverity openssh-6.3p1/clientloop.c
aaf34e5
--- openssh-6.3p1/clientloop.c.coverity	2013-06-10 05:07:12.000000000 +0200
aaf34e5
+++ openssh-6.3p1/clientloop.c	2013-10-07 13:20:36.289298058 +0200
aaf34e5
@@ -2068,14 +2068,15 @@ client_input_global_request(int type, u_
5cd882e
 	char *rtype;
5cd882e
 	int want_reply;
5cd882e
 	int success = 0;
5cd882e
+/* success is still 0 the packet is allways SSH2_MSG_REQUEST_FAILURE, isn't it? */
5cd882e
 
5cd882e
 	rtype = packet_get_string(NULL);
5cd882e
 	want_reply = packet_get_char();
5cd882e
 	debug("client_input_global_request: rtype %s want_reply %d",
5cd882e
 	    rtype, want_reply);
5cd882e
 	if (want_reply) {
5cd882e
-		packet_start(success ?
5cd882e
-		    SSH2_MSG_REQUEST_SUCCESS : SSH2_MSG_REQUEST_FAILURE);
5cd882e
+		packet_start(/*success ?
5cd882e
+		    SSH2_MSG_REQUEST_SUCCESS :*/ SSH2_MSG_REQUEST_FAILURE);
5cd882e
 		packet_send();
5cd882e
 		packet_write_wait();
5cd882e
 	}
aaf34e5
diff -up openssh-6.3p1/key.c.coverity openssh-6.3p1/key.c
aaf34e5
--- openssh-6.3p1/key.c.coverity	2013-06-01 23:41:51.000000000 +0200
aaf34e5
+++ openssh-6.3p1/key.c	2013-10-07 13:20:36.290298054 +0200
aaf34e5
@@ -807,8 +807,10 @@ key_read(Key *ret, char **cpp)
99254d5
 		success = 1;
99254d5
 /*XXXX*/
99254d5
 		key_free(k);
99254d5
+/*XXXX
99254d5
 		if (success != 1)
99254d5
 			break;
99254d5
+XXXX*/
99254d5
 		/* advance cp: skip whitespace and data */
99254d5
 		while (*cp == ' ' || *cp == '\t')
99254d5
 			cp++;
aaf34e5
diff -up openssh-6.3p1/monitor.c.coverity openssh-6.3p1/monitor.c
aaf34e5
--- openssh-6.3p1/monitor.c.coverity	2013-07-20 05:21:53.000000000 +0200
aaf34e5
+++ openssh-6.3p1/monitor.c	2013-10-07 13:54:36.761314042 +0200
5cd882e
@@ -449,7 +449,7 @@ monitor_child_preauth(Authctxt *_authctx
5cd882e
 	mm_get_keystate(pmonitor);
99254d5
 
99254d5
 	/* Drain any buffered messages from the child */
99254d5
-	while (pmonitor->m_log_recvfd != -1 && monitor_read_log(pmonitor) == 0)
99254d5
+	while (pmonitor->m_log_recvfd >= 0 && monitor_read_log(pmonitor) == 0)
99254d5
 		;
99254d5
 
5cd882e
 	close(pmonitor->m_sendfd);
aaf34e5
@@ -1202,6 +1202,10 @@ mm_answer_keyallowed(int sock, Buffer *m
99254d5
 			break;
99254d5
 		}
99254d5
 	}
99254d5
+
99254d5
+	debug3("%s: key %p is %s",
99254d5
+	    __func__, key, allowed ? "allowed" : "not allowed");
99254d5
+
99254d5
 	if (key != NULL)
99254d5
 		key_free(key);
99254d5
 
aaf34e5
@@ -1223,9 +1227,6 @@ mm_answer_keyallowed(int sock, Buffer *m
aaf34e5
 		free(chost);
99254d5
 	}
99254d5
 
99254d5
-	debug3("%s: key %p is %s",
99254d5
-	    __func__, key, allowed ? "allowed" : "not allowed");
99254d5
-
99254d5
 	buffer_clear(m);
99254d5
 	buffer_put_int(m, allowed);
99254d5
 	buffer_put_int(m, forced_command != NULL);
aaf34e5
diff -up openssh-6.3p1/monitor_wrap.c.coverity openssh-6.3p1/monitor_wrap.c
aaf34e5
--- openssh-6.3p1/monitor_wrap.c.coverity	2013-06-02 00:07:32.000000000 +0200
aaf34e5
+++ openssh-6.3p1/monitor_wrap.c	2013-10-07 13:20:36.291298049 +0200
aaf34e5
@@ -710,10 +710,10 @@ mm_pty_allocate(int *ptyfd, int *ttyfd,
99254d5
 	if ((tmp1 = dup(pmonitor->m_recvfd)) == -1 ||
99254d5
 	    (tmp2 = dup(pmonitor->m_recvfd)) == -1) {
99254d5
 		error("%s: cannot allocate fds for pty", __func__);
99254d5
-		if (tmp1 > 0)
99254d5
+		if (tmp1 >= 0)
99254d5
 			close(tmp1);
99254d5
-		if (tmp2 > 0)
99254d5
-			close(tmp2);
99254d5
+		/*DEAD CODE if (tmp2 >= 0)
99254d5
+			close(tmp2);*/
99254d5
 		return 0;
99254d5
 	}
99254d5
 	close(tmp1);
aaf34e5
diff -up openssh-6.3p1/openbsd-compat/bindresvport.c.coverity openssh-6.3p1/openbsd-compat/bindresvport.c
aaf34e5
--- openssh-6.3p1/openbsd-compat/bindresvport.c.coverity	2010-12-03 00:50:26.000000000 +0100
aaf34e5
+++ openssh-6.3p1/openbsd-compat/bindresvport.c	2013-10-07 13:20:36.291298049 +0200
99254d5
@@ -58,7 +58,7 @@ bindresvport_sa(int sd, struct sockaddr
99254d5
 	struct sockaddr_in6 *in6;
99254d5
 	u_int16_t *portp;
99254d5
 	u_int16_t port;
99254d5
-	socklen_t salen;
99254d5
+	socklen_t salen = sizeof(struct sockaddr_storage);
99254d5
 	int i;
99254d5
 
99254d5
 	if (sa == NULL) {
aaf34e5
diff -up openssh-6.3p1/packet.c.coverity openssh-6.3p1/packet.c
aaf34e5
--- openssh-6.3p1/packet.c.coverity	2013-07-18 08:12:45.000000000 +0200
aaf34e5
+++ openssh-6.3p1/packet.c	2013-10-07 13:20:36.291298049 +0200
aaf34e5
@@ -1199,6 +1199,7 @@ packet_read_poll1(void)
99254d5
 		case DEATTACK_DETECTED:
99254d5
 			packet_disconnect("crc32 compensation attack: "
99254d5
 			    "network attack detected");
99254d5
+			break;
99254d5
 		case DEATTACK_DOS_DETECTED:
99254d5
 			packet_disconnect("deattack denial of "
99254d5
 			    "service detected");
aaf34e5
diff -up openssh-6.3p1/progressmeter.c.coverity openssh-6.3p1/progressmeter.c
aaf34e5
--- openssh-6.3p1/progressmeter.c.coverity	2013-06-02 15:46:24.000000000 +0200
aaf34e5
+++ openssh-6.3p1/progressmeter.c	2013-10-07 13:42:32.377850691 +0200
99254d5
@@ -65,7 +65,7 @@ static void update_progress_meter(int);
99254d5
 
99254d5
 static time_t start;		/* start progress */
99254d5
 static time_t last_update;	/* last progress update */
99254d5
-static char *file;		/* name of the file being transferred */
99254d5
+static const char *file;	/* name of the file being transferred */
99254d5
 static off_t end_pos;		/* ending position of transfer */
99254d5
 static off_t cur_pos;		/* transfer position as of last refresh */
99254d5
 static volatile off_t *counter;	/* progress counter */
99254d5
@@ -247,7 +247,7 @@ update_progress_meter(int ignore)
99254d5
 }
99254d5
 
99254d5
 void
99254d5
-start_progress_meter(char *f, off_t filesize, off_t *ctr)
99254d5
+start_progress_meter(const char *f, off_t filesize, off_t *ctr)
99254d5
 {
aaf34e5
 	start = last_update = monotime();
99254d5
 	file = f;
aaf34e5
diff -up openssh-6.3p1/progressmeter.h.coverity openssh-6.3p1/progressmeter.h
aaf34e5
--- openssh-6.3p1/progressmeter.h.coverity	2006-03-26 05:30:02.000000000 +0200
aaf34e5
+++ openssh-6.3p1/progressmeter.h	2013-10-07 13:20:36.292298044 +0200
99254d5
@@ -23,5 +23,5 @@
99254d5
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
99254d5
  */
99254d5
 
99254d5
-void	start_progress_meter(char *, off_t, off_t *);
99254d5
+void	start_progress_meter(const char *, off_t, off_t *);
99254d5
 void	stop_progress_meter(void);
aaf34e5
diff -up openssh-6.3p1/scp.c.coverity openssh-6.3p1/scp.c
aaf34e5
--- openssh-6.3p1/scp.c.coverity	2013-07-18 08:11:25.000000000 +0200
aaf34e5
+++ openssh-6.3p1/scp.c	2013-10-07 13:20:36.292298044 +0200
99254d5
@@ -155,7 +155,7 @@ killchild(int signo)
99254d5
 {
99254d5
 	if (do_cmd_pid > 1) {
99254d5
 		kill(do_cmd_pid, signo ? signo : SIGTERM);
99254d5
-		waitpid(do_cmd_pid, NULL, 0);
99254d5
+		(void) waitpid(do_cmd_pid, NULL, 0);
99254d5
 	}
99254d5
 
99254d5
 	if (signo)
aaf34e5
diff -up openssh-6.3p1/servconf.c.coverity openssh-6.3p1/servconf.c
aaf34e5
--- openssh-6.3p1/servconf.c.coverity	2013-07-20 05:21:53.000000000 +0200
aaf34e5
+++ openssh-6.3p1/servconf.c	2013-10-07 13:20:36.293298039 +0200
aaf34e5
@@ -1323,7 +1323,7 @@ process_server_config_line(ServerOptions
99254d5
 			fatal("%s line %d: Missing subsystem name.",
99254d5
 			    filename, linenum);
99254d5
 		if (!*activep) {
99254d5
-			arg = strdelim(&cp;;
99254d5
+			/*arg =*/ (void) strdelim(&cp;;
99254d5
 			break;
99254d5
 		}
99254d5
 		for (i = 0; i < options->num_subsystems; i++)
aaf34e5
@@ -1414,8 +1414,9 @@ process_server_config_line(ServerOptions
99254d5
 		if (*activep && *charptr == NULL) {
99254d5
 			*charptr = tilde_expand_filename(arg, getuid());
99254d5
 			/* increase optional counter */
99254d5
-			if (intptr != NULL)
99254d5
-				*intptr = *intptr + 1;
99254d5
+			/* DEAD CODE intptr is still NULL ;)
99254d5
+  			 if (intptr != NULL)
99254d5
+				*intptr = *intptr + 1; */
99254d5
 		}
99254d5
 		break;
99254d5
 
aaf34e5
diff -up openssh-6.3p1/serverloop.c.coverity openssh-6.3p1/serverloop.c
aaf34e5
--- openssh-6.3p1/serverloop.c.coverity	2013-07-18 08:12:45.000000000 +0200
aaf34e5
+++ openssh-6.3p1/serverloop.c	2013-10-07 13:43:36.620537138 +0200
99254d5
@@ -147,13 +147,13 @@ notify_setup(void)
99254d5
 static void
99254d5
 notify_parent(void)
99254d5
 {
99254d5
-	if (notify_pipe[1] != -1)
99254d5
+	if (notify_pipe[1] >= 0)
aaf34e5
 		(void)write(notify_pipe[1], "", 1);
99254d5
 }
99254d5
 static void
99254d5
 notify_prepare(fd_set *readset)
99254d5
 {
99254d5
-	if (notify_pipe[0] != -1)
99254d5
+	if (notify_pipe[0] >= 0)
99254d5
 		FD_SET(notify_pipe[0], readset);
99254d5
 }
99254d5
 static void
99254d5
@@ -161,8 +161,8 @@ notify_done(fd_set *readset)
99254d5
 {
99254d5
 	char c;
99254d5
 
99254d5
-	if (notify_pipe[0] != -1 && FD_ISSET(notify_pipe[0], readset))
99254d5
-		while (read(notify_pipe[0], &c, 1) != -1)
99254d5
+	if (notify_pipe[0] >= 0 && FD_ISSET(notify_pipe[0], readset))
99254d5
+		while (read(notify_pipe[0], &c, 1) >= 0)
99254d5
 			debug2("notify_done: reading");
99254d5
 }
99254d5
 
edfa524
@@ -336,7 +336,7 @@ wait_until_can_do_something(fd_set **rea
99254d5
 		 * If we have buffered data, try to write some of that data
99254d5
 		 * to the program.
99254d5
 		 */
99254d5
-		if (fdin != -1 && buffer_len(&stdin_buffer) > 0)
99254d5
+		if (fdin >= 0 && buffer_len(&stdin_buffer) > 0)
99254d5
 			FD_SET(fdin, *writesetp);
99254d5
 	}
99254d5
 	notify_prepare(*readsetp);
edfa524
@@ -476,7 +476,7 @@ process_output(fd_set *writeset)
99254d5
 	int len;
99254d5
 
99254d5
 	/* Write buffered data to program stdin. */
99254d5
-	if (!compat20 && fdin != -1 && FD_ISSET(fdin, writeset)) {
99254d5
+	if (!compat20 && fdin >= 0 && FD_ISSET(fdin, writeset)) {
99254d5
 		data = buffer_ptr(&stdin_buffer);
99254d5
 		dlen = buffer_len(&stdin_buffer);
99254d5
 		len = write(fdin, data, dlen);
edfa524
@@ -589,7 +589,7 @@ server_loop(pid_t pid, int fdin_arg, int
99254d5
 	set_nonblock(fdin);
99254d5
 	set_nonblock(fdout);
99254d5
 	/* we don't have stderr for interactive terminal sessions, see below */
99254d5
-	if (fderr != -1)
99254d5
+	if (fderr >= 0)
99254d5
 		set_nonblock(fderr);
99254d5
 
99254d5
 	if (!(datafellows & SSH_BUG_IGNOREMSG) && isatty(fdin))
edfa524
@@ -613,7 +613,7 @@ server_loop(pid_t pid, int fdin_arg, int
99254d5
 	max_fd = MAX(connection_in, connection_out);
99254d5
 	max_fd = MAX(max_fd, fdin);
99254d5
 	max_fd = MAX(max_fd, fdout);
99254d5
-	if (fderr != -1)
99254d5
+	if (fderr >= 0)
99254d5
 		max_fd = MAX(max_fd, fderr);
99254d5
 #endif
99254d5
 
edfa524
@@ -643,7 +643,7 @@ server_loop(pid_t pid, int fdin_arg, int
99254d5
 		 * If we have received eof, and there is no more pending
99254d5
 		 * input data, cause a real eof by closing fdin.
99254d5
 		 */
99254d5
-		if (stdin_eof && fdin != -1 && buffer_len(&stdin_buffer) == 0) {
99254d5
+		if (stdin_eof && fdin >= 0 && buffer_len(&stdin_buffer) == 0) {
99254d5
 			if (fdin != fdout)
99254d5
 				close(fdin);
99254d5
 			else
aaf34e5
@@ -739,15 +739,15 @@ server_loop(pid_t pid, int fdin_arg, int
99254d5
 	buffer_free(&stderr_buffer);
99254d5
 
99254d5
 	/* Close the file descriptors. */
99254d5
-	if (fdout != -1)
99254d5
+	if (fdout >= 0)
99254d5
 		close(fdout);
99254d5
 	fdout = -1;
99254d5
 	fdout_eof = 1;
99254d5
-	if (fderr != -1)
99254d5
+	if (fderr >= 0)
99254d5
 		close(fderr);
99254d5
 	fderr = -1;
99254d5
 	fderr_eof = 1;
99254d5
-	if (fdin != -1)
99254d5
+	if (fdin >= 0)
99254d5
 		close(fdin);
99254d5
 	fdin = -1;
99254d5
 
aaf34e5
@@ -946,7 +946,7 @@ server_input_window_size(int type, u_int
99254d5
 
99254d5
 	debug("Window change received.");
99254d5
 	packet_check_eom();
99254d5
-	if (fdin != -1)
99254d5
+	if (fdin >= 0)
99254d5
 		pty_change_window_size(fdin, row, col, xpixel, ypixel);
99254d5
 }
99254d5
 
aaf34e5
@@ -1006,7 +1006,7 @@ server_request_tun(void)
99254d5
 	}
99254d5
 
99254d5
 	tun = packet_get_int();
99254d5
-	if (forced_tun_device != -1) {
99254d5
+	if (forced_tun_device >= 0) {
99254d5
 		if (tun != SSH_TUNID_ANY && forced_tun_device != tun)
99254d5
 			goto done;
99254d5
 		tun = forced_tun_device;
aaf34e5
diff -up openssh-6.3p1/sftp-client.c.coverity openssh-6.3p1/sftp-client.c
aaf34e5
--- openssh-6.3p1/sftp-client.c.coverity	2013-07-26 00:40:00.000000000 +0200
aaf34e5
+++ openssh-6.3p1/sftp-client.c	2013-10-07 13:48:45.885027420 +0200
99254d5
@@ -149,7 +149,7 @@ get_msg(struct sftp_conn *conn, Buffer *
99254d5
 }
99254d5
 
99254d5
 static void
99254d5
-send_string_request(struct sftp_conn *conn, u_int id, u_int code, char *s,
99254d5
+send_string_request(struct sftp_conn *conn, u_int id, u_int code, const char *s,
99254d5
     u_int len)
99254d5
 {
99254d5
 	Buffer msg;
99254d5
@@ -165,7 +165,7 @@ send_string_request(struct sftp_conn *co
99254d5
 
99254d5
 static void
99254d5
 send_string_attrs_request(struct sftp_conn *conn, u_int id, u_int code,
99254d5
-    char *s, u_int len, Attrib *a)
99254d5
+    const char *s, u_int len, Attrib *a)
99254d5
 {
99254d5
 	Buffer msg;
99254d5
 
99254d5
@@ -422,7 +422,7 @@ sftp_proto_version(struct sftp_conn *con
99254d5
 }
99254d5
 
99254d5
 int
99254d5
-do_close(struct sftp_conn *conn, char *handle, u_int handle_len)
99254d5
+do_close(struct sftp_conn *conn, const char *handle, u_int handle_len)
99254d5
 {
99254d5
 	u_int id, status;
99254d5
 	Buffer msg;
99254d5
@@ -447,7 +447,7 @@ do_close(struct sftp_conn *conn, char *h
99254d5
 
99254d5
 
99254d5
 static int
99254d5
-do_lsreaddir(struct sftp_conn *conn, char *path, int printflag,
99254d5
+do_lsreaddir(struct sftp_conn *conn, const char *path, int printflag,
99254d5
     SFTP_DIRENT ***dir)
99254d5
 {
99254d5
 	Buffer msg;
edfa524
@@ -572,7 +572,7 @@ do_lsreaddir(struct sftp_conn *conn, cha
99254d5
 }
99254d5
 
99254d5
 int
99254d5
-do_readdir(struct sftp_conn *conn, char *path, SFTP_DIRENT ***dir)
99254d5
+do_readdir(struct sftp_conn *conn, const char *path, SFTP_DIRENT ***dir)
99254d5
 {
99254d5
 	return(do_lsreaddir(conn, path, 0, dir));
99254d5
 }
edfa524
@@ -590,7 +590,7 @@ void free_sftp_dirents(SFTP_DIRENT **s)
99254d5
 }
99254d5
 
99254d5
 int
99254d5
-do_rm(struct sftp_conn *conn, char *path)
99254d5
+do_rm(struct sftp_conn *conn, const char *path)
99254d5
 {
99254d5
 	u_int status, id;
99254d5
 
edfa524
@@ -605,7 +605,7 @@ do_rm(struct sftp_conn *conn, char *path
99254d5
 }
99254d5
 
99254d5
 int
99254d5
-do_mkdir(struct sftp_conn *conn, char *path, Attrib *a, int printflag)
99254d5
+do_mkdir(struct sftp_conn *conn, const char *path, Attrib *a, int printflag)
99254d5
 {
99254d5
 	u_int status, id;
99254d5
 
edfa524
@@ -621,7 +621,7 @@ do_mkdir(struct sftp_conn *conn, char *p
99254d5
 }
99254d5
 
99254d5
 int
99254d5
-do_rmdir(struct sftp_conn *conn, char *path)
99254d5
+do_rmdir(struct sftp_conn *conn, const char *path)
99254d5
 {
99254d5
 	u_int status, id;
99254d5
 
edfa524
@@ -637,7 +637,7 @@ do_rmdir(struct sftp_conn *conn, char *p
99254d5
 }
99254d5
 
99254d5
 Attrib *
99254d5
-do_stat(struct sftp_conn *conn, char *path, int quiet)
99254d5
+do_stat(struct sftp_conn *conn, const char *path, int quiet)
99254d5
 {
99254d5
 	u_int id;
99254d5
 
edfa524
@@ -651,7 +651,7 @@ do_stat(struct sftp_conn *conn, char *pa
99254d5
 }
99254d5
 
99254d5
 Attrib *
99254d5
-do_lstat(struct sftp_conn *conn, char *path, int quiet)
99254d5
+do_lstat(struct sftp_conn *conn, const char *path, int quiet)
99254d5
 {
99254d5
 	u_int id;
99254d5
 
edfa524
@@ -685,7 +685,7 @@ do_fstat(struct sftp_conn *conn, char *h
99254d5
 #endif
99254d5
 
99254d5
 int
99254d5
-do_setstat(struct sftp_conn *conn, char *path, Attrib *a)
99254d5
+do_setstat(struct sftp_conn *conn, const char *path, Attrib *a)
99254d5
 {
99254d5
 	u_int status, id;
99254d5
 
edfa524
@@ -702,7 +702,7 @@ do_setstat(struct sftp_conn *conn, char
99254d5
 }
99254d5
 
99254d5
 int
99254d5
-do_fsetstat(struct sftp_conn *conn, char *handle, u_int handle_len,
99254d5
+do_fsetstat(struct sftp_conn *conn, const char *handle, u_int handle_len,
99254d5
     Attrib *a)
99254d5
 {
99254d5
 	u_int status, id;
edfa524
@@ -719,7 +719,7 @@ do_fsetstat(struct sftp_conn *conn, char
99254d5
 }
99254d5
 
99254d5
 char *
99254d5
-do_realpath(struct sftp_conn *conn, char *path)
99254d5
+do_realpath(struct sftp_conn *conn, const char *path)
99254d5
 {
99254d5
 	Buffer msg;
99254d5
 	u_int type, expected_id, count, id;
edfa524
@@ -768,7 +768,7 @@ do_realpath(struct sftp_conn *conn, char
99254d5
 }
99254d5
 
99254d5
 int
99254d5
-do_rename(struct sftp_conn *conn, char *oldpath, char *newpath)
99254d5
+do_rename(struct sftp_conn *conn, const char *oldpath, const char *newpath)
99254d5
 {
99254d5
 	Buffer msg;
99254d5
 	u_int status, id;
edfa524
@@ -802,7 +802,7 @@ do_rename(struct sftp_conn *conn, char *
99254d5
 }
99254d5
 
99254d5
 int
99254d5
-do_hardlink(struct sftp_conn *conn, char *oldpath, char *newpath)
99254d5
+do_hardlink(struct sftp_conn *conn, const char *oldpath, const char *newpath)
99254d5
 {
99254d5
 	Buffer msg;
99254d5
 	u_int status, id;
edfa524
@@ -835,7 +835,7 @@ do_hardlink(struct sftp_conn *conn, char
99254d5
 }
99254d5
 
99254d5
 int
99254d5
-do_symlink(struct sftp_conn *conn, char *oldpath, char *newpath)
99254d5
+do_symlink(struct sftp_conn *conn, const char *oldpath, const char *newpath)
99254d5
 {
99254d5
 	Buffer msg;
99254d5
 	u_int status, id;
edfa524
@@ -987,7 +987,7 @@ send_read_request(struct sftp_conn *conn
99254d5
 }
99254d5
 
99254d5
 int
99254d5
-do_download(struct sftp_conn *conn, char *remote_path, char *local_path,
99254d5
+do_download(struct sftp_conn *conn, const char *remote_path, const char *local_path,
aaf34e5
     Attrib *a, int pflag, int resume)
99254d5
 {
99254d5
 	Attrib junk;
aaf34e5
@@ -1255,7 +1255,7 @@ do_download(struct sftp_conn *conn, char
99254d5
 }
99254d5
 
99254d5
 static int
99254d5
-download_dir_internal(struct sftp_conn *conn, char *src, char *dst,
99254d5
+download_dir_internal(struct sftp_conn *conn, const char *src, const char *dst,
aaf34e5
     Attrib *dirattrib, int pflag, int printflag, int depth, int resume)
99254d5
 {
99254d5
 	int i, ret = 0;
aaf34e5
@@ -1345,7 +1345,7 @@ download_dir_internal(struct sftp_conn *
99254d5
 }
99254d5
 
99254d5
 int
99254d5
-download_dir(struct sftp_conn *conn, char *src, char *dst,
99254d5
+download_dir(struct sftp_conn *conn, const char *src, const char *dst,
aaf34e5
     Attrib *dirattrib, int pflag, int printflag, int resume)
99254d5
 {
99254d5
 	char *src_canon;
aaf34e5
@@ -1363,7 +1363,7 @@ download_dir(struct sftp_conn *conn, cha
99254d5
 }
99254d5
 
99254d5
 int
99254d5
-do_upload(struct sftp_conn *conn, char *local_path, char *remote_path,
99254d5
+do_upload(struct sftp_conn *conn, const char *local_path, const char *remote_path,
99254d5
     int pflag)
99254d5
 {
99254d5
 	int local_fd;
aaf34e5
@@ -1548,7 +1548,7 @@ do_upload(struct sftp_conn *conn, char *
99254d5
 }
99254d5
 
99254d5
 static int
99254d5
-upload_dir_internal(struct sftp_conn *conn, char *src, char *dst,
99254d5
+upload_dir_internal(struct sftp_conn *conn, const char *src, const char *dst,
99254d5
     int pflag, int printflag, int depth)
99254d5
 {
99254d5
 	int ret = 0, status;
aaf34e5
@@ -1639,7 +1639,7 @@ upload_dir_internal(struct sftp_conn *co
99254d5
 }
99254d5
 
99254d5
 int
99254d5
-upload_dir(struct sftp_conn *conn, char *src, char *dst, int printflag,
99254d5
+upload_dir(struct sftp_conn *conn, const char *src, const char *dst, int printflag,
99254d5
     int pflag)
99254d5
 {
99254d5
 	char *dst_canon;
aaf34e5
@@ -1656,7 +1656,7 @@ upload_dir(struct sftp_conn *conn, char
99254d5
 }
99254d5
 
99254d5
 char *
99254d5
-path_append(char *p1, char *p2)
99254d5
+path_append(const char *p1, const char *p2)
99254d5
 {
99254d5
 	char *ret;
99254d5
 	size_t len = strlen(p1) + strlen(p2) + 2;
aaf34e5
diff -up openssh-6.3p1/sftp-client.h.coverity openssh-6.3p1/sftp-client.h
aaf34e5
--- openssh-6.3p1/sftp-client.h.coverity	2013-07-25 03:56:52.000000000 +0200
aaf34e5
+++ openssh-6.3p1/sftp-client.h	2013-10-07 13:45:10.108080813 +0200
99254d5
@@ -56,49 +56,49 @@ struct sftp_conn *do_init(int, int, u_in
99254d5
 u_int sftp_proto_version(struct sftp_conn *);
99254d5
 
99254d5
 /* Close file referred to by 'handle' */
99254d5
-int do_close(struct sftp_conn *, char *, u_int);
99254d5
+int do_close(struct sftp_conn *, const char *, u_int);
99254d5
 
99254d5
 /* Read contents of 'path' to NULL-terminated array 'dir' */
99254d5
-int do_readdir(struct sftp_conn *, char *, SFTP_DIRENT ***);
99254d5
+int do_readdir(struct sftp_conn *, const char *, SFTP_DIRENT ***);
99254d5
 
99254d5
 /* Frees a NULL-terminated array of SFTP_DIRENTs (eg. from do_readdir) */
99254d5
 void free_sftp_dirents(SFTP_DIRENT **);
99254d5
 
99254d5
 /* Delete file 'path' */
99254d5
-int do_rm(struct sftp_conn *, char *);
99254d5
+int do_rm(struct sftp_conn *, const char *);
99254d5
 
99254d5
 /* Create directory 'path' */
99254d5
-int do_mkdir(struct sftp_conn *, char *, Attrib *, int);
99254d5
+int do_mkdir(struct sftp_conn *, const char *, Attrib *, int);
99254d5
 
99254d5
 /* Remove directory 'path' */
99254d5
-int do_rmdir(struct sftp_conn *, char *);
99254d5
+int do_rmdir(struct sftp_conn *, const char *);
99254d5
 
99254d5
 /* Get file attributes of 'path' (follows symlinks) */
99254d5
-Attrib *do_stat(struct sftp_conn *, char *, int);
99254d5
+Attrib *do_stat(struct sftp_conn *, const char *, int);
99254d5
 
99254d5
 /* Get file attributes of 'path' (does not follow symlinks) */
99254d5
-Attrib *do_lstat(struct sftp_conn *, char *, int);
99254d5
+Attrib *do_lstat(struct sftp_conn *, const char *, int);
99254d5
 
99254d5
 /* Set file attributes of 'path' */
99254d5
-int do_setstat(struct sftp_conn *, char *, Attrib *);
99254d5
+int do_setstat(struct sftp_conn *, const char *, Attrib *);
99254d5
 
99254d5
 /* Set file attributes of open file 'handle' */
99254d5
-int do_fsetstat(struct sftp_conn *, char *, u_int, Attrib *);
99254d5
+int do_fsetstat(struct sftp_conn *, const char *, u_int, Attrib *);
99254d5
 
99254d5
 /* Canonicalise 'path' - caller must free result */
99254d5
-char *do_realpath(struct sftp_conn *, char *);
99254d5
+char *do_realpath(struct sftp_conn *, const char *);
99254d5
 
99254d5
 /* Get statistics for filesystem hosting file at "path" */
99254d5
 int do_statvfs(struct sftp_conn *, const char *, struct sftp_statvfs *, int);
99254d5
 
99254d5
 /* Rename 'oldpath' to 'newpath' */
99254d5
-int do_rename(struct sftp_conn *, char *, char *);
99254d5
+int do_rename(struct sftp_conn *, const char *, const char *);
99254d5
 
99254d5
 /* Link 'oldpath' to 'newpath' */
99254d5
-int do_hardlink(struct sftp_conn *, char *, char *);
99254d5
+int do_hardlink(struct sftp_conn *, const char *, const char *);
99254d5
 
99254d5
-/* Rename 'oldpath' to 'newpath' */
99254d5
-int do_symlink(struct sftp_conn *, char *, char *);
99254d5
+/* Symlink 'oldpath' to 'newpath' */
99254d5
+int do_symlink(struct sftp_conn *, const char *, const char *);
99254d5
 
99254d5
 /* XXX: add callbacks to do_download/do_upload so we can do progress meter */
99254d5
 
99254d5
@@ -106,27 +106,27 @@ int do_symlink(struct sftp_conn *, char
99254d5
  * Download 'remote_path' to 'local_path'. Preserve permissions and times
99254d5
  * if 'pflag' is set
99254d5
  */
aaf34e5
-int do_download(struct sftp_conn *, char *, char *, Attrib *, int, int);
aaf34e5
+int do_download(struct sftp_conn *, const char *, const char *, Attrib *, int, int);
99254d5
 
99254d5
 /*
99254d5
  * Recursively download 'remote_directory' to 'local_directory'. Preserve 
99254d5
  * times if 'pflag' is set
99254d5
  */
aaf34e5
-int download_dir(struct sftp_conn *, char *, char *, Attrib *, int, int, int);
aaf34e5
+int download_dir(struct sftp_conn *, const char *, const char *, Attrib *, int, int, int);
99254d5
 
99254d5
 /*
99254d5
  * Upload 'local_path' to 'remote_path'. Preserve permissions and times
99254d5
  * if 'pflag' is set
99254d5
  */
99254d5
-int do_upload(struct sftp_conn *, char *, char *, int);
99254d5
+int do_upload(struct sftp_conn *, const char *, const char *, int);
99254d5
 
99254d5
 /*
99254d5
  * Recursively upload 'local_directory' to 'remote_directory'. Preserve 
99254d5
  * times if 'pflag' is set
99254d5
  */
99254d5
-int upload_dir(struct sftp_conn *, char *, char *, int, int);
99254d5
+int upload_dir(struct sftp_conn *, const char *, const char *, int, int);
99254d5
 
99254d5
 /* Concatenate paths, taking care of slashes. Caller must free result. */
99254d5
-char *path_append(char *, char *);
99254d5
+char *path_append(const char *, const char *);
99254d5
 
99254d5
 #endif
aaf34e5
diff -up openssh-6.3p1/sftp.c.coverity openssh-6.3p1/sftp.c
aaf34e5
--- openssh-6.3p1/sftp.c.coverity	2013-07-25 03:56:52.000000000 +0200
aaf34e5
+++ openssh-6.3p1/sftp.c	2013-10-07 13:49:47.322727449 +0200
aaf34e5
@@ -213,7 +213,7 @@ killchild(int signo)
aaf34e5
 {
aaf34e5
 	if (sshpid > 1) {
aaf34e5
 		kill(sshpid, SIGTERM);
aaf34e5
-		waitpid(sshpid, NULL, 0);
aaf34e5
+		(void) waitpid(sshpid, NULL, 0);
aaf34e5
 	}
aaf34e5
 
aaf34e5
 	_exit(1);
aaf34e5
@@ -324,7 +324,7 @@ local_do_ls(const char *args)
aaf34e5
 
aaf34e5
 /* Strip one path (usually the pwd) from the start of another */
aaf34e5
 static char *
aaf34e5
-path_strip(char *path, char *strip)
aaf34e5
+path_strip(const char *path, const char *strip)
aaf34e5
 {
aaf34e5
 	size_t len;
aaf34e5
 
aaf34e5
@@ -342,7 +342,7 @@ path_strip(char *path, char *strip)
aaf34e5
 }
aaf34e5
 
aaf34e5
 static char *
aaf34e5
-make_absolute(char *p, char *pwd)
aaf34e5
+make_absolute(char *p, const char *pwd)
aaf34e5
 {
aaf34e5
 	char *abs_str;
aaf34e5
 
aaf34e5
@@ -493,7 +493,7 @@ parse_df_flags(const char *cmd, char **a
aaf34e5
 }
aaf34e5
 
aaf34e5
 static int
aaf34e5
-is_dir(char *path)
aaf34e5
+is_dir(const char *path)
aaf34e5
 {
aaf34e5
 	struct stat sb;
aaf34e5
 
aaf34e5
@@ -505,7 +505,7 @@ is_dir(char *path)
aaf34e5
 }
aaf34e5
 
aaf34e5
 static int
aaf34e5
-remote_is_dir(struct sftp_conn *conn, char *path)
aaf34e5
+remote_is_dir(struct sftp_conn *conn, const char *path)
aaf34e5
 {
aaf34e5
 	Attrib *a;
aaf34e5
 
aaf34e5
@@ -519,7 +519,7 @@ remote_is_dir(struct sftp_conn *conn, ch
aaf34e5
 
aaf34e5
 /* Check whether path returned from glob(..., GLOB_MARK, ...) is a directory */
aaf34e5
 static int
aaf34e5
-pathname_is_dir(char *pathname)
aaf34e5
+pathname_is_dir(const char *pathname)
aaf34e5
 {
aaf34e5
 	size_t l = strlen(pathname);
aaf34e5
 
aaf34e5
@@ -527,7 +527,7 @@ pathname_is_dir(char *pathname)
aaf34e5
 }
aaf34e5
 
aaf34e5
 static int
aaf34e5
-process_get(struct sftp_conn *conn, char *src, char *dst, char *pwd,
aaf34e5
+process_get(struct sftp_conn *conn, const char *src, const char *dst, const char *pwd,
aaf34e5
     int pflag, int rflag, int resume)
aaf34e5
 {
aaf34e5
 	char *abs_src = NULL;
aaf34e5
@@ -605,7 +605,7 @@ out:
aaf34e5
 }
aaf34e5
 
aaf34e5
 static int
aaf34e5
-process_put(struct sftp_conn *conn, char *src, char *dst, char *pwd,
aaf34e5
+process_put(struct sftp_conn *conn, const char *src, const char *dst, const char *pwd,
aaf34e5
     int pflag, int rflag)
aaf34e5
 {
aaf34e5
 	char *tmp_dst = NULL;
aaf34e5
@@ -709,7 +709,7 @@ sdirent_comp(const void *aa, const void
aaf34e5
 
aaf34e5
 /* sftp ls.1 replacement for directories */
aaf34e5
 static int
aaf34e5
-do_ls_dir(struct sftp_conn *conn, char *path, char *strip_path, int lflag)
aaf34e5
+do_ls_dir(struct sftp_conn *conn, const char *path, const char *strip_path, int lflag)
aaf34e5
 {
aaf34e5
 	int n;
aaf34e5
 	u_int c = 1, colspace = 0, columns = 1;
aaf34e5
@@ -794,7 +794,7 @@ do_ls_dir(struct sftp_conn *conn, char *
aaf34e5
 
aaf34e5
 /* sftp ls.1 replacement which handles path globs */
aaf34e5
 static int
aaf34e5
-do_globbed_ls(struct sftp_conn *conn, char *path, char *strip_path,
aaf34e5
+do_globbed_ls(struct sftp_conn *conn, const char *path, const char *strip_path,
aaf34e5
     int lflag)
aaf34e5
 {
aaf34e5
 	char *fname, *lname;
aaf34e5
@@ -875,7 +875,7 @@ do_globbed_ls(struct sftp_conn *conn, ch
aaf34e5
 }
aaf34e5
 
aaf34e5
 static int
aaf34e5
-do_df(struct sftp_conn *conn, char *path, int hflag, int iflag)
aaf34e5
+do_df(struct sftp_conn *conn, const char *path, int hflag, int iflag)
aaf34e5
 {
aaf34e5
 	struct sftp_statvfs st;
aaf34e5
 	char s_used[FMT_SCALED_STRSIZE];
aaf34e5
diff -up openssh-6.3p1/ssh-agent.c.coverity openssh-6.3p1/ssh-agent.c
aaf34e5
--- openssh-6.3p1/ssh-agent.c.coverity	2013-07-20 05:22:49.000000000 +0200
aaf34e5
+++ openssh-6.3p1/ssh-agent.c	2013-10-07 13:20:36.296298024 +0200
aaf34e5
@@ -1143,8 +1143,8 @@ main(int ac, char **av)
99254d5
 	sanitise_stdfd();
99254d5
 
99254d5
 	/* drop */
99254d5
-	setegid(getgid());
99254d5
-	setgid(getgid());
99254d5
+	(void) setegid(getgid());
99254d5
+	(void) setgid(getgid());
99254d5
 
99254d5
 #if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE)
99254d5
 	/* Disable ptrace on Linux without sgid bit */
aaf34e5
diff -up openssh-6.3p1/sshd.c.coverity openssh-6.3p1/sshd.c
aaf34e5
--- openssh-6.3p1/sshd.c.coverity	2013-07-20 05:21:53.000000000 +0200
aaf34e5
+++ openssh-6.3p1/sshd.c	2013-10-07 13:20:36.296298024 +0200
aaf34e5
@@ -699,8 +699,10 @@ privsep_preauth(Authctxt *authctxt)
99254d5
 		if (getuid() == 0 || geteuid() == 0)
99254d5
 			privsep_preauth_child();
99254d5
 		setproctitle("%s", "[net]");
99254d5
-		if (box != NULL)
99254d5
+		if (box != NULL) {
99254d5
 			ssh_sandbox_child(box);
aaf34e5
+			free(box);
99254d5
+		}
99254d5
 
99254d5
 		return 0;
99254d5
 	}
aaf34e5
@@ -1345,6 +1347,9 @@ server_accept_loop(int *sock_in, int *so
99254d5
 		if (num_listen_socks < 0)
99254d5
 			break;
99254d5
 	}
99254d5
+
99254d5
+	if (fdset != NULL)
aaf34e5
+		free(fdset);
99254d5
 }
99254d5
 
99254d5