Prevent fclose(NULL) on SELinux (bb #2200).

0.96
Török Edvin 15 years ago
parent 80faa52898
commit a78f2183ed
  1. 4
      ChangeLog
  2. 8
      libclamav/bytecode_detect.c

@ -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

@ -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;
}

Loading…
Cancel
Save