summaryrefslogtreecommitdiff
path: root/common-session.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2018-02-17 19:29:51 +0800
committerMatt Johnston <matt@ucc.asn.au>2018-02-17 19:29:51 +0800
commit104e39e9caf447cb416a6d83ea7eedd4481ce4c3 (patch)
treeb8b33aaee9f7336e592da7a916ee05bae3412c22 /common-session.c
parent2b551518f8625f87a22ea1fde40e3c7d841bf9d0 (diff)
parent769be133237df6d9a4028645e7e9924be8544c8f (diff)
downloaddropbear-104e39e9caf447cb416a6d83ea7eedd4481ce4c3.tar.gz
merge from main
Diffstat (limited to 'common-session.c')
-rw-r--r--common-session.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/common-session.c b/common-session.c
index 5cc3a86..556adeb 100644
--- a/common-session.c
+++ b/common-session.c
@@ -75,14 +75,18 @@ void common_session_init(int sock_in, int sock_out) {
ses.last_packet_time_any_sent = 0;
ses.last_packet_time_keepalive_sent = 0;
+#ifdef DROPBEAR_FUZZ
+ if (!fuzz.fuzzing)
+#endif
+ {
if (pipe(ses.signal_pipe) < 0) {
dropbear_exit("Signal pipe failed");
}
setnonblocking(ses.signal_pipe[0]);
setnonblocking(ses.signal_pipe[1]);
-
ses.maxfd = MAX(ses.maxfd, ses.signal_pipe[0]);
ses.maxfd = MAX(ses.maxfd, ses.signal_pipe[1]);
+ }
ses.writepayload = buf_new(TRANS_MAX_PAYLOAD_LEN);
ses.transseq = 0;
@@ -154,7 +158,12 @@ void session_loop(void(*loophandler)()) {
/* We get woken up when signal handlers write to this pipe.
SIGCHLD in svr-chansession is the only one currently. */
+#ifdef DROPBEAR_FUZZ
+ if (!fuzz.fuzzing)
+#endif
+ {
FD_SET(ses.signal_pipe[0], &readfd);
+ }
/* set up for channels which can be read/written */
setchannelfds(&readfd, &writefd, writequeue_has_space);
@@ -298,6 +307,16 @@ void session_cleanup() {
buf_free(dequeue(&ses.writequeue));
}
+ m_free(ses.newkeys);
+#ifndef DISABLE_ZLIB
+ if (ses.keys->recv.zstream != NULL) {
+ if (inflateEnd(ses.keys->recv.zstream) == Z_STREAM_ERROR) {
+ dropbear_exit("Crypto error");
+ }
+ m_free(ses.keys->recv.zstream);
+ }
+#endif
+
m_free(ses.remoteident);
m_free(ses.authstate.pw_dir);
m_free(ses.authstate.pw_name);