diff options
author | Bodo Möller <bodo@openssl.org> | 2001-02-06 10:14:57 +0000 |
---|---|---|
committer | Bodo Möller <bodo@openssl.org> | 2001-02-06 10:14:57 +0000 |
commit | c7410f2693eba9a45d94998053c01f86304f919b (patch) | |
tree | 496f68cd4e4c5779e74b11a719cb473d4a4836ce /crypto/conf/conf_lib.c | |
parent | 43a5e1409ee12af31a841ae67d8486753e7e53b7 (diff) |
Avoid coredumps for CONF_get_...(NULL, ...)
Diffstat (limited to 'crypto/conf/conf_lib.c')
-rw-r--r-- | crypto/conf/conf_lib.c | 57 |
1 files changed, 39 insertions, 18 deletions
diff --git a/crypto/conf/conf_lib.c b/crypto/conf/conf_lib.c index 51bd0db655..11ec639732 100644 --- a/crypto/conf/conf_lib.c +++ b/crypto/conf/conf_lib.c @@ -131,38 +131,59 @@ LHASH *CONF_load_bio(LHASH *conf, BIO *bp,long *eline) STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,char *section) { - CONF ctmp; + if (conf == NULL) + { + return NULL; + } + else + { + CONF ctmp; - if (default_CONF_method == NULL) - default_CONF_method = NCONF_default(); + if (default_CONF_method == NULL) + default_CONF_method = NCONF_default(); - default_CONF_method->init(&ctmp); - ctmp.data = conf; - return NCONF_get_section(&ctmp, section); + default_CONF_method->init(&ctmp); + ctmp.data = conf; + return NCONF_get_section(&ctmp, section); + } } char *CONF_get_string(LHASH *conf,char *group,char *name) { - CONF ctmp; + if (conf == NULL) + { + return NCONF_get_string(NULL, group, name); + } + else + { + CONF ctmp; - if (default_CONF_method == NULL) - default_CONF_method = NCONF_default(); + if (default_CONF_method == NULL) + default_CONF_method = NCONF_default(); - default_CONF_method->init(&ctmp); - ctmp.data = conf; - return NCONF_get_string(&ctmp, group, name); + default_CONF_method->init(&ctmp); + ctmp.data = conf; + return NCONF_get_string(&ctmp, group, name); + } } long CONF_get_number(LHASH *conf,char *group,char *name) { - CONF ctmp; + if (conf == NULL) + { + return NCONF_get_number(NULL, group, name); + } + else + { + CONF ctmp; - if (default_CONF_method == NULL) - default_CONF_method = NCONF_default(); + if (default_CONF_method == NULL) + default_CONF_method = NCONF_default(); - default_CONF_method->init(&ctmp); - ctmp.data = conf; - return NCONF_get_number(&ctmp, group, name); + default_CONF_method->init(&ctmp); + ctmp.data = conf; + return NCONF_get_number(&ctmp, group, name); + } } void CONF_free(LHASH *conf) |