Mercurial > dropbear
changeset 1327:e47e4b8a005d
initialize variable and protect against NULL dereferencement
author | Francois Perrad <francois.perrad@gadz.org> |
---|---|
date | Tue, 15 Nov 2016 15:36:05 +0100 |
parents | 79225928bf59 |
children | c13aa2cd8d51 |
files | cli-tcpfwd.c |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/cli-tcpfwd.c Fri Jan 01 11:46:58 2016 +0100 +++ b/cli-tcpfwd.c Tue Nov 15 15:36:05 2016 +0100 @@ -234,7 +234,7 @@ 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 @@ } - 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\"",