diff options
Diffstat (limited to '')
-rw-r--r-- | src/lib/libcrypto/x509/x509_utl.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/libcrypto/x509/x509_utl.c b/src/lib/libcrypto/x509/x509_utl.c index 1a043d93d5..b6f1919b39 100644 --- a/src/lib/libcrypto/x509/x509_utl.c +++ b/src/lib/libcrypto/x509/x509_utl.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: x509_utl.c,v 1.9 2023/04/23 09:58:38 tb Exp $ */ | 1 | /* $OpenBSD: x509_utl.c,v 1.10 2023/04/23 10:19:52 tb Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project. | 3 | * project. |
4 | */ | 4 | */ |
@@ -471,9 +471,11 @@ hex_to_string(const unsigned char *buffer, long len) | |||
471 | int i; | 471 | int i; |
472 | static const char hexdig[] = "0123456789ABCDEF"; | 472 | static const char hexdig[] = "0123456789ABCDEF"; |
473 | 473 | ||
474 | if (!buffer || !len) | 474 | if (len < 0) |
475 | return NULL; | 475 | return NULL; |
476 | if (!(tmp = malloc(len * 3 + 1))) { | 476 | if (len == 0) |
477 | return calloc(1, 1); | ||
478 | if ((tmp = calloc(len, 3)) == NULL) { | ||
477 | X509V3error(ERR_R_MALLOC_FAILURE); | 479 | X509V3error(ERR_R_MALLOC_FAILURE); |
478 | return NULL; | 480 | return NULL; |
479 | } | 481 | } |