|
|
6bbd11 |
autofs-5.1.0 - fix FILE pointer check in defaults_read_config()
|
|
|
6bbd11 |
|
|
|
6bbd11 |
From: Ian Kent <raven@themaw.net>
|
|
|
6bbd11 |
|
|
|
6bbd11 |
Fix possible use after free usage of FILE pointer in defaults_read_config().
|
|
|
6bbd11 |
---
|
|
|
6bbd11 |
CHANGELOG | 1 +
|
|
|
6bbd11 |
lib/defaults.c | 15 +++++++--------
|
|
|
6bbd11 |
2 files changed, 8 insertions(+), 8 deletions(-)
|
|
|
6bbd11 |
|
|
|
6bbd11 |
--- autofs-5.0.7.orig/CHANGELOG
|
|
|
6bbd11 |
+++ autofs-5.0.7/CHANGELOG
|
|
|
6bbd11 |
@@ -132,6 +132,7 @@
|
|
|
6bbd11 |
- fix race accessing qdn in get_query_dn().
|
|
|
6bbd11 |
- fix leak in cache_push_mapent().
|
|
|
6bbd11 |
- fix config entry read buffer not checked.
|
|
|
6bbd11 |
+- fix FILE pointer check in defaults_read_config().
|
|
|
6bbd11 |
|
|
|
6bbd11 |
25/07/2012 autofs-5.0.7
|
|
|
6bbd11 |
=======================
|
|
|
6bbd11 |
--- autofs-5.0.7.orig/lib/defaults.c
|
|
|
6bbd11 |
+++ autofs-5.0.7/lib/defaults.c
|
|
|
6bbd11 |
@@ -1055,6 +1055,8 @@ unsigned int defaults_read_config(unsign
|
|
|
6bbd11 |
|
|
|
6bbd11 |
ret = 1;
|
|
|
6bbd11 |
|
|
|
6bbd11 |
+ conf = oldconf = NULL;
|
|
|
6bbd11 |
+
|
|
|
6bbd11 |
pthread_mutex_lock(&conf_mutex);
|
|
|
6bbd11 |
if (!config) {
|
|
|
6bbd11 |
if (conf_init()) {
|
|
|
6bbd11 |
@@ -1081,15 +1083,11 @@ unsigned int defaults_read_config(unsign
|
|
|
6bbd11 |
stb.st_mtime <= config->modified &&
|
|
|
6bbd11 |
(oldstat = fstat(fileno(oldconf), &oldstb) == -1) &&
|
|
|
6bbd11 |
oldstb.st_mtime <= config->modified) {
|
|
|
6bbd11 |
- fclose(conf);
|
|
|
6bbd11 |
- fclose(oldconf);
|
|
|
6bbd11 |
goto out;
|
|
|
6bbd11 |
}
|
|
|
6bbd11 |
|
|
|
6bbd11 |
if (conf || oldconf) {
|
|
|
6bbd11 |
if (!reset_defaults(to_syslog)) {
|
|
|
6bbd11 |
- fclose(conf);
|
|
|
6bbd11 |
- fclose(oldconf);
|
|
|
6bbd11 |
ret = 0;
|
|
|
6bbd11 |
goto out;
|
|
|
6bbd11 |
}
|
|
|
6bbd11 |
@@ -1107,10 +1105,8 @@ unsigned int defaults_read_config(unsign
|
|
|
6bbd11 |
}
|
|
|
6bbd11 |
}
|
|
|
6bbd11 |
|
|
|
6bbd11 |
- if (conf) {
|
|
|
6bbd11 |
+ if (conf)
|
|
|
6bbd11 |
read_config(to_syslog, conf, DEFAULT_CONFIG_FILE);
|
|
|
6bbd11 |
- fclose(conf);
|
|
|
6bbd11 |
- }
|
|
|
6bbd11 |
|
|
|
6bbd11 |
/*
|
|
|
6bbd11 |
* Read the old config file and override the installed
|
|
|
6bbd11 |
@@ -1131,7 +1127,6 @@ unsigned int defaults_read_config(unsign
|
|
|
6bbd11 |
clean_ldap_multi_option(NAME_LDAP_URI);
|
|
|
6bbd11 |
|
|
|
6bbd11 |
read_config(to_syslog, oldconf, OLD_CONFIG_FILE);
|
|
|
6bbd11 |
- fclose(oldconf);
|
|
|
6bbd11 |
|
|
|
6bbd11 |
if (ldap_search_base) {
|
|
|
6bbd11 |
co = conf_lookup(sec, NAME_SEARCH_BASE);
|
|
|
6bbd11 |
@@ -1150,6 +1145,10 @@ unsigned int defaults_read_config(unsign
|
|
|
6bbd11 |
}
|
|
|
6bbd11 |
}
|
|
|
6bbd11 |
out:
|
|
|
6bbd11 |
+ if (conf)
|
|
|
6bbd11 |
+ fclose(conf);
|
|
|
6bbd11 |
+ if (oldconf)
|
|
|
6bbd11 |
+ fclose(oldconf);
|
|
|
6bbd11 |
pthread_mutex_unlock(&conf_mutex);
|
|
|
6bbd11 |
return ret;
|
|
|
6bbd11 |
}
|