summaryrefslogtreecommitdiffstats
path: root/ext/openssl/ossl_cipher.c
diff options
context:
space:
mode:
authorgotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-10-30 20:50:48 +0000
committergotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-10-30 20:50:48 +0000
commit433e0247f3ec5f941a3fd0f6a3d6c48d584271c8 (patch)
treee327e28367dca475e171b96faa2e314b4deb3b74 /ext/openssl/ossl_cipher.c
parentd61b409d777dd7e0c10243098d0eb6d6ee29a8ea (diff)
downloadruby-433e0247f3ec5f941a3fd0f6a3d6c48d584271c8.tar.gz
ruby-433e0247f3ec5f941a3fd0f6a3d6c48d584271c8.tar.xz
ruby-433e0247f3ec5f941a3fd0f6a3d6c48d584271c8.zip
* ext/openssl/ossl_cipher.c (ossl_cipher_update): input data must
not be empty. [ruby-talk:161220] * test/openssl/test_cipher.rb: add test for Cipher#update(""). git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@9485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/ossl_cipher.c')
-rw-r--r--ext/openssl/ossl_cipher.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/openssl/ossl_cipher.c b/ext/openssl/ossl_cipher.c
index f90fb2477..bc72d7e53 100644
--- a/ext/openssl/ossl_cipher.c
+++ b/ext/openssl/ossl_cipher.c
@@ -224,7 +224,8 @@ ossl_cipher_update(VALUE self, VALUE data)
StringValue(data);
in = RSTRING(data)->ptr;
- in_len = RSTRING(data)->len;
+ if ((in_len = RSTRING(data)->len) == 0)
+ rb_raise(rb_eArgError, "data must not be empty");
GetCipher(self, ctx);
str = rb_str_new(0, in_len+EVP_CIPHER_CTX_block_size(ctx));
if (!EVP_CipherUpdate(ctx, RSTRING(str)->ptr, &out_len, in, in_len))