diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2012-03-04 23:56:06 +0100 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2012-03-04 23:56:06 +0100 |
commit | ce3c2407d9ac8cc5b45bda5f5991ac0fa89d1d98 (patch) | |
tree | f1588aabdb93c3c137dd48ce5559eb7d73b56056 /methods | |
parent | f685054e7e37c2d24dd0f0391c6d5a4e1a0b9099 (diff) |
fix "(error) Possible null pointer dereference: BindAddr" by ensuring
that BindAddr isn't NULL after getaddrinfo()
Diffstat (limited to 'methods')
-rw-r--r-- | methods/ftp.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/methods/ftp.cc b/methods/ftp.cc index b1e8d2b0a..89c81f384 100644 --- a/methods/ftp.cc +++ b/methods/ftp.cc @@ -721,14 +721,14 @@ bool FTPConn::CreateDataFd() DataListenFd = -1; // Get the information for a listening socket. - struct addrinfo *BindAddr = 0; + struct addrinfo *BindAddr = NULL; struct addrinfo Hints; memset(&Hints,0,sizeof(Hints)); Hints.ai_socktype = SOCK_STREAM; Hints.ai_flags |= AI_PASSIVE; Hints.ai_family = ((struct sockaddr *)&ServerAddr)->sa_family; int Res; - if ((Res = getaddrinfo(0,"0",&Hints,&BindAddr)) != 0) + if ((Res = getaddrinfo(0,"0",&Hints,&BindAddr)) != 0 || BindAddr == NULL) return _error->Error(_("getaddrinfo was unable to get a listening socket")); // Construct the socket |