aboutsummaryrefslogtreecommitdiff
path: root/crypto/asn1/a_dup.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/asn1/a_dup.c')
-rw-r--r--crypto/asn1/a_dup.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/crypto/asn1/a_dup.c b/crypto/asn1/a_dup.c
index 93e8b2aa8dab..e673023faee8 100644
--- a/crypto/asn1/a_dup.c
+++ b/crypto/asn1/a_dup.c
@@ -1,5 +1,5 @@
/*
- * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2024 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -28,10 +28,8 @@ void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, const void *x)
return NULL;
b = OPENSSL_malloc(i + 10);
- if (b == NULL) {
- ERR_raise(ERR_LIB_ASN1, ERR_R_MALLOC_FAILURE);
+ if (b == NULL)
return NULL;
- }
p = b;
i = i2d(x, &p);
p2 = b;
@@ -77,8 +75,8 @@ void *ASN1_item_dup(const ASN1_ITEM *it, const void *x)
}
i = ASN1_item_i2d(x, &b, it);
- if (b == NULL) {
- ERR_raise(ERR_LIB_ASN1, ERR_R_MALLOC_FAILURE);
+ if (i < 0 || b == NULL) {
+ ERR_raise(ERR_LIB_ASN1, ERR_R_ASN1_LIB);
return NULL;
}
p = b;