mirror of
https://github.com/Cisco-Talos/clamav.git
synced 2026-05-06 14:45:52 -04:00
Prevent fclose(NULL) on SELinux (bb #2200).
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user