summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/openssl/ossl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/openssl/ossl.c b/ext/openssl/ossl.c
index f4a3fc4c99..9f605f0161 100644
--- a/ext/openssl/ossl.c
+++ b/ext/openssl/ossl.c
@@ -133,7 +133,7 @@ ossl_buf2str(char *buf, int len)
int status = 0;
str = rb_protect((VALUE(*)_(()))ossl_str_new, len, &status);
- memcpy(RSTRING(str)->ptr, buf, len);
+ if(!NIL_P(str)) memcpy(RSTRING(str)->ptr, buf, len);
OPENSSL_free(buf);
if(status) rb_jump_tag(status);