aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Andree <matthias.andree@gmx.de>2006-06-28 09:47:43 +0000
committerMatthias Andree <matthias.andree@gmx.de>2006-06-28 09:47:43 +0000
commit8e71aeb4c1ed10442a36d861250c23f2c3d89ce9 (patch)
tree32ec71b1fdb68a0e399d1bf817e7bf51cdf7c245
parentdd89bd0d8e92e56977a64252ec567ec24044859c (diff)
downloadfetchmail-8e71aeb4c1ed10442a36d861250c23f2c3d89ce9.tar.gz
fetchmail-8e71aeb4c1ed10442a36d861250c23f2c3d89ce9.tar.bz2
fetchmail-8e71aeb4c1ed10442a36d861250c23f2c3d89ce9.zip
* When looking up ports for a service, the lookup succeeds and the
returned address family isn't IPv4 or IPv6, properly free the allocated memory from the service lookup. Found by Uli Zappe. * When looking up ports for a service, only look up TCP ports. svn path=/branches/BRANCH_6-3/; revision=4855
-rw-r--r--NEWS4
-rw-r--r--servport.c4
2 files changed, 7 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 10237e5f..cde27dba 100644
--- a/NEWS
+++ b/NEWS
@@ -85,6 +85,10 @@ fetchmail 6.3.5 (not yet released):
* Fetchmail no longer attempts to stat the "-" file in daemon mode -- this is a
special name to read the RC file from stdin, and cannot always be re-read
anyways. BerliOS bug #7858.
+* When looking up ports for a service, the lookup succeeds and the returned
+ address family isn't IPv4 or IPv6, properly free the allocated memory from the
+ service lookup. Found by Uli Zappe.
+* When looking up ports for a service, only look up TCP ports.
# CHANGES:
* Rename all fetchmail-internal lock_* functions to fm_lock_*. Obsoletes
diff --git a/servport.c b/servport.c
index 01b84607..2849f7c2 100644
--- a/servport.c
+++ b/servport.c
@@ -1,6 +1,6 @@
/** \file servport.c Resolve service name to port number.
* \author Matthias Andree
- * \date 2005
+ * \date 2005 - 2006
*
* Copyright (C) 2005 by Matthias Andree
* For license terms, see the file COPYING in this directory.
@@ -47,6 +47,7 @@ int servport(const char *service) {
memset(&hints, 0, sizeof hints);
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
+ hints.ai_protocol = IPPROTO_TCP;
e = getaddrinfo(NULL, service, &hints, &res);
if (e) {
report(stderr, GT_("getaddrinfo(NULL, \"%s\") error: %s\n"),
@@ -63,6 +64,7 @@ int servport(const char *service) {
break;
#endif
default:
+ freeaddrinfo(res);
goto err;
}
freeaddrinfo(res);