summaryrefslogtreecommitdiff
path: root/methods/ftp.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2012-03-04 23:56:06 +0100
committerDavid Kalnischkies <kalnischkies@gmail.com>2012-03-04 23:56:06 +0100
commitce3c2407d9ac8cc5b45bda5f5991ac0fa89d1d98 (patch)
treef1588aabdb93c3c137dd48ce5559eb7d73b56056 /methods/ftp.cc
parentf685054e7e37c2d24dd0f0391c6d5a4e1a0b9099 (diff)
fix "(error) Possible null pointer dereference: BindAddr" by ensuring
that BindAddr isn't NULL after getaddrinfo()
Diffstat (limited to 'methods/ftp.cc')
-rw-r--r--methods/ftp.cc4
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