diff options
author | Michal Rokos <m.rokos@sh.cvut.cz> | 2003-07-22 07:14:01 +0000 |
---|---|---|
committer | Michal Rokos <m.rokos@sh.cvut.cz> | 2003-07-22 07:14:01 +0000 |
commit | 21a0e700ce206496e2f0f53ff597af6d4234f5d4 (patch) | |
tree | dfae921098997e38e943c4a659a8dceff056943f | |
parent | fb5023c32e94135d4aceef8a1367f7f4143ee346 (diff) | |
download | ruby-openssl-history-21a0e700ce206496e2f0f53ff597af6d4234f5d4.tar.gz |
Config fixes
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | ossl_config.c | 11 |
2 files changed, 11 insertions, 3 deletions
@@ -1,3 +1,6 @@ +Tue, 22 Jul 2003 08:59:21 +0200 -- Michal Rokos <m.rokos@sh.cvut.cz> + * config.c: Copy filename to local buf, report correct error when file not found + Tue, 22 Jul 2003 08:33:41 +0200 -- Michal Rokos <m.rokos@sh.cvut.cz> * Indenting diff --git a/ossl_config.c b/ossl_config.c index 5e8cfcd..f721bb9 100644 --- a/ossl_config.c +++ b/ossl_config.c @@ -41,7 +41,7 @@ static VALUE ossl_config_s_load(int argc, VALUE *argv, VALUE klass) { CONF *conf; - long err_line; + long err_line = -1; char *filename; VALUE path, obj; @@ -61,12 +61,17 @@ ossl_config_s_load(int argc, VALUE *argv, VALUE klass) OSSL_Debug("Loading file: %s", filename); if (!NCONF_load(conf, filename, &err_line)) { + char tmp[255]; + + memcpy(tmp, filename, strlen(filename)>=sizeof(tmp)?sizeof(tmp):strlen(filename)); + tmp[sizeof(tmp)-1] = '\0'; OPENSSL_free(filename); + if (err_line <= 0) { - ossl_raise(eConfigError, "wrong config file (%s)", filename); + ossl_raise(eConfigError, "wrong config file (%s)", tmp); } else { ossl_raise(eConfigError, "error on line %ld in config file \"%s\"", - err_line, filename); + err_line, tmp); } } OPENSSL_free(filename); |