diff options
author | Francois Perrad <francois.perrad@gadz.org> | 2016-11-15 15:36:05 +0100 |
---|---|---|
committer | Francois Perrad <francois.perrad@gadz.org> | 2016-11-15 15:36:05 +0100 |
commit | 0d9c3fe70b828ff4af3a7b9fa20a169afa1a1fae (patch) | |
tree | 69682ee5349807e7a9f9a5276b85e4dc76586548 /cli-tcpfwd.c | |
parent | 2e38ac7504db6452fa1b0096f35efd55e95d12df (diff) |
initialize variable and protect against NULL dereferencement
Diffstat (limited to 'cli-tcpfwd.c')
-rw-r--r-- | cli-tcpfwd.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cli-tcpfwd.c b/cli-tcpfwd.c index 95b2d7c..78f61f7 100644 --- a/cli-tcpfwd.c +++ b/cli-tcpfwd.c @@ -234,7 +234,7 @@ static int newtcpforwarded(struct Channel * channel) { char *origaddr = NULL; unsigned int origport; m_list_elem * iter = NULL; - struct TCPFwdEntry *fwd; + struct TCPFwdEntry *fwd = NULL; char portstring[NI_MAXSERV]; int err = SSH_OPEN_ADMINISTRATIVELY_PROHIBITED; @@ -265,7 +265,7 @@ static int newtcpforwarded(struct Channel * channel) { } - if (iter == NULL) { + if (iter == NULL || fwd == NULL) { /* We didn't request forwarding on that port */ cleantext(origaddr); dropbear_log(LOG_INFO, "Server sent unrequested forward from \"%s:%d\"", |