aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--ossl_config.c11
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 <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);