[Pkg-clamav-commits] [SCM] Debian repository for ClamAV branch, debian/unstable, updated. 99ae9353f6834da0cb73f59f4b32d1f0ae1263fa
Stephen Gran
steve at lobefin.net
Thu Sep 4 12:36:54 UTC 2008
The following commit has been merged in the debian/unstable branch:
commit 70a092065a3e2d9c292a4d25ebbfc377233192ff
Author: Stephen Gran <steve at lobefin.net>
Date: Thu Sep 4 13:25:33 2008 +0100
Revert "merge r3830 from trunk"
This reverts commit 636cc682c9b3fec4744357386af4be4caf59fe71.
diff --git a/ChangeLog b/ChangeLog
index a4331fd..9fa8887 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,3 @@
-Fri May 2 20:09:56 EEST 2008 (edwin)
-------------------------------------
- * libclamav/mbox.c, shared/network.c: prevent uninitialized use of hostent
- structure (bb #1003).
-
Wed Apr 30 14:15:53 CEST 2008 (tk)
----------------------------------
* libclamav/mspack.c: downgrade some error messages (bb#911)
diff --git a/libclamav/mbox.c b/libclamav/mbox.c
index 586ccad..ca2ea77 100644
--- a/libclamav/mbox.c
+++ b/libclamav/mbox.c
@@ -4454,15 +4454,13 @@ getURL(struct arg *arg)
static int
my_r_gethostbyname(const char *hostname, struct hostent *hp, char *buf, size_t len)
{
+#if defined(HAVE_GETHOSTBYNAME_R_6)
+ /* e.g. Linux */
struct hostent *hp2;
int ret = -1;
if((hostname == NULL) || (hp == NULL))
return -1;
- memset(hp, 0, sizeof(struct hostent));
-#if defined(HAVE_GETHOSTBYNAME_R_6)
- /* e.g. Linux */
-
if(gethostbyname_r(hostname, hp, buf, len, &hp2, &ret) < 0)
return ret;
#elif defined(HAVE_GETHOSTBYNAME_R_5)
@@ -4472,17 +4470,28 @@ my_r_gethostbyname(const char *hostname, struct hostent *hp, char *buf, size_t l
* doesn't add it, so you need to do something like
* LIBS=-lnet ./configure --enable-cache --disable-clamav
*/
+ int ret = -1;
+
+ if((hostname == NULL) || (hp == NULL))
+ return -1;
if(gethostbyname_r(hostname, hp, buf, len, &ret) == NULL)
return ret;
#elif defined(HAVE_GETHOSTBYNAME_R_3)
/* e.g. HP/UX, AIX */
+ if((hostname == NULL) || (hp == NULL))
+ return -1;
if(gethostbyname_r(hostname, &hp, (struct hostent_data *)buf) < 0)
return h_errno;
#else
/* Single thread the code e.g. VS2005 */
+ struct hostent *hp2;
#ifdef CL_THREAD_SAFE
static pthread_mutex_t hostent_mutex = PTHREAD_MUTEX_INITIALIZER;
+#endif
+ if((hostname == NULL) || (hp == NULL))
+ return -1;
+#ifdef CL_THREAD_SAFE
pthread_mutex_lock(&hostent_mutex);
#endif
if((hp2 = gethostbyname(hostname)) == NULL) {
diff --git a/shared/network.c b/shared/network.c
index 98c3979..8ac3a62 100644
--- a/shared/network.c
+++ b/shared/network.c
@@ -60,29 +60,39 @@
*/
int r_gethostbyname(const char *hostname, struct hostent *hp, char *buf, size_t len)
{
+#if defined(HAVE_GETHOSTBYNAME_R_6)
+ /* e.g. Linux */
struct hostent *hp2;
int ret = -1;
if((hostname == NULL) || (hp == NULL))
return -1;
- memset(hp, 0, sizeof(struct hostent));
-#if defined(HAVE_GETHOSTBYNAME_R_6)
- /* e.g. Linux */
if(gethostbyname_r(hostname, hp, buf, len, &hp2, &ret) < 0)
return ret;
#elif defined(HAVE_GETHOSTBYNAME_R_5)
/* e.g. BSD, Solaris, Cygwin */
+ int ret = -1;
+
+ if((hostname == NULL) || (hp == NULL))
+ return -1;
if(gethostbyname_r(hostname, hp, buf, len, &ret) == NULL)
return ret;
#elif defined(HAVE_GETHOSTBYNAME_R_3)
/* e.g. HP/UX, AIX */
+ if((hostname == NULL) || (hp == NULL))
+ return -1;
if(gethostbyname_r(hostname, &hp, (struct hostent_data *)buf) < 0)
return h_errno;
#else
/* Single thread the code e.g. VS2005 */
+ struct hostent *hp2;
#ifdef CL_THREAD_SAFE
static pthread_mutex_t hostent_mutex = PTHREAD_MUTEX_INITIALIZER;
+#endif
+ if((hostname == NULL) || (hp == NULL))
+ return -1;
+#ifdef CL_THREAD_SAFE
pthread_mutex_lock(&hostent_mutex);
#endif
if((hp2 = gethostbyname(hostname)) == NULL) {
--
Debian repository for ClamAV
More information about the Pkg-clamav-commits
mailing list