From 9cc8a834665988c7088bf387381bc18ff9aad45a Mon Sep 17 00:00:00 2001 From: Kazuki Yamaguchi Date: Wed, 11 Dec 2024 00:59:37 +0900 Subject: [PATCH] digest: make output buffer String independent in #finish Likewise, OpenSSL::Digest#finish needs to make the output buffer independent before writing to it. --- ext/openssl/ossl_digest.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/openssl/ossl_digest.c b/ext/openssl/ossl_digest.c index fc326ec14..015d8eb58 100644 --- a/ext/openssl/ossl_digest.c +++ b/ext/openssl/ossl_digest.c @@ -232,6 +232,7 @@ ossl_digest_finish(int argc, VALUE *argv, VALUE self) str = rb_str_new(NULL, out_len); } else { StringValue(str); + rb_str_modify(str); rb_str_resize(str, out_len); }