aboutsummaryrefslogtreecommitdiffstats
path: root/ext/openssl
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2016-10-22 00:14:43 +0900
committerKazuki Yamaguchi <k@rhe.jp>2016-10-22 00:33:08 +0900
commitef85d20903c39b99758a701f55d6cc20f4e273f2 (patch)
treebbf26a764b7c9a2b13d9a711bcf5b395f9012391 /ext/openssl
parent41944f14ad191a7853c567c3807a711fa2c24226 (diff)
downloadruby-openssl-ef85d20903c39b99758a701f55d6cc20f4e273f2.tar.gz
Fix error message on too long PEM password
When a too long password is given as the PEM password, an exception with the message "password must be shorter than 1024 bytes" is raised. But this is not really accurate. The effective password actually can be up to PEM_BUFSIZE (== 1024) bytes long.
Diffstat (limited to 'ext/openssl')
-rw-r--r--ext/openssl/ossl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/openssl/ossl.c b/ext/openssl/ossl.c
index 07238780..7b5482c1 100644
--- a/ext/openssl/ossl.c
+++ b/ext/openssl/ossl.c
@@ -149,7 +149,7 @@ ossl_pem_passwd_value(VALUE pass)
/* PEM_BUFSIZE is currently used as the second argument of pem_password_cb,
* that is +max_len+ of ossl_pem_passwd_cb() */
if (RSTRING_LEN(pass) > PEM_BUFSIZE)
- ossl_raise(eOSSLError, "password must be shorter than %d bytes", PEM_BUFSIZE);
+ ossl_raise(eOSSLError, "password must not be longer than %d bytes", PEM_BUFSIZE);
return pass;
}
@@ -209,7 +209,7 @@ ossl_pem_passwd_cb(char *buf, int max_len, int flag, void *pwd_)
continue;
}
if (len > max_len) {
- rb_warning("password must be shorter than %d bytes", max_len);
+ rb_warning("password must not be longer than %d bytes", max_len);
continue;
}
memcpy(buf, RSTRING_PTR(pass), len);