From 9fe25f4b06c0f49b6c8a8c7a6eef3ea1d3fb9d9a Mon Sep 17 00:00:00 2001 From: Michal Rokos Date: Tue, 22 Jul 2003 07:14:01 +0000 Subject: Config fixes --- ChangeLog | 3 +++ ossl_config.c | 11 ++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1602382..f81a2bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +Tue, 22 Jul 2003 08:59:21 +0200 -- Michal Rokos + * config.c: Copy filename to local buf, report correct error when file not found + Tue, 22 Jul 2003 08:33:41 +0200 -- Michal Rokos * 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); -- cgit v1.2.3