Re: clamav 0.96.2

Kim Bisgaard <[email protected]>
Newsgroups gmane.linux.redhat.rpm.atrpms.devel
Message-ID <[email protected]>
   Hi Axel,

Have been running my own version for the past days without problems.

I have just tried upgrading to your version, but it segmentation faults. 
Perhaps the mailer did something to the patch I sent inline, like 
breaking long lines, so that it does not apply cleanly? I have attatched 
my version of the file.

Regards,
Kim

On 18-08-2010 19:35, Kim Bisgaard wrote:
> I have just seen a new page at clamav:
> https://wiki.clamav.net/Main/UpgradeNotes0962
>
> which has this patch I'm just rebuild and is about to try out - just
> hang on .... :
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,7 @@
> +Fri Aug 13 13:57:04 EEST 2010 (edwin)
> +--------------------------------------
> + * libclamav/bytecode_detect.c: prevent fclose(NULL) on SELinux (bb
> #2200)
> +
>  Thu Aug 12 18:49:37 CEST 2010 (tk)
>  ----------------------------------
>   * V 0.96.2
> diff --git a/libclamav/bytecode_detect.c b/libclamav/bytecode_detect.c
> index 6311314..9271fc7 100644
> --- a/libclamav/bytecode_detect.c
> +++ b/libclamav/bytecode_detect.c
> @@ -109,9 +109,11 @@ static int detect_SELinux(void)
>      f = fopen("/selinux/enforce", "r");
>          if (!f && errno == EACCES)
>          return 2;
> -    if (fscanf(f, "%d", &enforce) == 1)
> +    if (f) {
> +        if (fscanf(f, "%d", &enforce) == 1)
>          selinux = 2;
> -    fclose(f);
> +        fclose(f);
> +    }
>      return selinux;
>      }
>      while (fgets(line, sizeof(line), f)) {
> @@ -130,8 +132,8 @@ static int detect_SELinux(void)
>          selinux = 2;
>      if (enforce == -1)
>          selinux = 0;
> +    fclose(f);
>      }
> -    fclose(f);
>      return selinux;
>  }
>
> On 18-08-2010 17:26, Axel Thimm wrote:
>> Hi,
>>
>> On Fri, 2010-08-13 at 11:41 +0200, Kim Bisgaard wrote:
>>> Hi,
>>>
>>> I have tried to build (change the spec to above version) the newly
>>> released clamav-0.96.2. It builds ok once one adds 'BuildRequires:
>>> sendmail-milter', *BUT* here it core dumps once I try to run it.
>>>
>>> I have tried to get the debug-symbols, and starting clamd in gdb but
>>> when started in debugger it does not core dump :-( could be a selinux
>>> thing - but I have not found any AVC's that makes the core dump go
>>> away.
>>>
>>> This is f13 and i686.
>>>
>>> I advice to hold off the update until a patch shows up.
>>
>> Thanks for the heads-up. I did build it, but I placed it under bleeding:
>>
>> http://packages.atrpms.net/name/clamav/
>>
>> Can you check whether this build exhibits the same issues like you
>> describe above? Thanks!
>
> _______________________________________________
> atrpms-devel mailing list
> [email protected]
> http://lists.atrpms.net/mailman/listinfo/atrpms-devel
clamav-0.96.2-selinux.patch (text/x-patch, 981 B)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Fri Aug 13 13:57:04 EEST 2010 (edwin)
+--------------------------------------
+ * libclamav/bytecode_detect.c: prevent fclose(NULL) on SELinux (bb #2200)
+
 Thu Aug 12 18:49:37 CEST 2010 (tk)
 ----------------------------------
  * V 0.96.2
diff --git a/libclamav/bytecode_detect.c b/libclamav/bytecode_detect.c
index 6311314..9271fc7 100644
--- a/libclamav/bytecode_detect.c
+++ b/libclamav/bytecode_detect.c
@@ -109,9 +109,11 @@ static int detect_SELinux(void)
 	f = fopen("/selinux/enforce", "r");
         if (!f && errno == EACCES)
 		return 2;
-	if (fscanf(f, "%d", &enforce) == 1)
+	if (f) {
+	    if (fscanf(f, "%d", &enforce) == 1)
 		selinux = 2;
-	fclose(f);
+	    fclose(f);
+	}
 	return selinux;
     }
     while (fgets(line, sizeof(line), f)) {
@@ -130,8 +132,8 @@ static int detect_SELinux(void)
 	    selinux = 2;
 	if (enforce == -1)
 	    selinux = 0;
+	fclose(f);
     }
-    fclose(f);
     return selinux;
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.