From f3e01c8d85d98eab502d7aaaa734a1f9f0b8e375 Mon Sep 17 00:00:00 2001 From: Kurt Roeckx Date: Sat, 6 Aug 2016 19:16:00 +0200 Subject: [PATCH] Fix off by 1 in ASN1_STRING_set() Reviewed-by: Rich Salz MR: #3176 (cherry picked from commit a73be798ced572a988d455d961a2387f6eccb549) --- crypto/asn1/asn1_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/asn1/asn1_lib.c b/crypto/asn1/asn1_lib.c index 80f5f2b014..e63e82a8b4 100644 --- a/crypto/asn1/asn1_lib.c +++ b/crypto/asn1/asn1_lib.c @@ -370,7 +370,7 @@ int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len) else len = strlen(data); } - if ((str->length < len) || (str->data == NULL)) { + if ((str->length <= len) || (str->data == NULL)) { c = str->data; if (c == NULL) str->data = OPENSSL_malloc(len + 1); -- 2.25.1