diff options
| author | tb <> | 2025-03-20 09:41:47 +0000 |
|---|---|---|
| committer | tb <> | 2025-03-20 09:41:47 +0000 |
| commit | dc037c8e2a8b5d7ac5744a0331ea0a65978e2a72 (patch) | |
| tree | 025c3390b926542211a318ab4397f649439afb4b /src | |
| parent | 8bb14039f52469491bf0058b1efdf0c75db6befc (diff) | |
| download | openbsd-dc037c8e2a8b5d7ac5744a0331ea0a65978e2a72.tar.gz openbsd-dc037c8e2a8b5d7ac5744a0331ea0a65978e2a72.tar.bz2 openbsd-dc037c8e2a8b5d7ac5744a0331ea0a65978e2a72.zip | |
Plug a memory leak in x509_name_encode()
This is nearly identical to a leak fixed by miod 10 years ago in
x509_name_canon() but was missed in r1.30. This entire file needs
a metric ton of bleach, but my head currently spins too much for
tackling this, so go with the cheap one-liner.
From Niels Dossche
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/asn1/x_name.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lib/libcrypto/asn1/x_name.c b/src/lib/libcrypto/asn1/x_name.c index 7bacd83340..c60714b74f 100644 --- a/src/lib/libcrypto/asn1/x_name.c +++ b/src/lib/libcrypto/asn1/x_name.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x_name.c,v 1.44 2024/07/08 14:48:49 beck Exp $ */ | 1 | /* $OpenBSD: x_name.c,v 1.45 2025/03/20 09:41:47 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -414,8 +414,10 @@ x509_name_encode(X509_NAME *a) | |||
| 414 | if (!entries) | 414 | if (!entries) |
| 415 | goto memerr; | 415 | goto memerr; |
| 416 | if (!sk_STACK_OF_X509_NAME_ENTRY_push(intname.s, | 416 | if (!sk_STACK_OF_X509_NAME_ENTRY_push(intname.s, |
| 417 | entries)) | 417 | entries)) { |
| 418 | sk_X509_NAME_ENTRY_free(entries); | ||
| 418 | goto memerr; | 419 | goto memerr; |
| 420 | } | ||
| 419 | set = entry->set; | 421 | set = entry->set; |
| 420 | } | 422 | } |
| 421 | if (entries == NULL /* if entry->set is bogusly -1 */ || | 423 | if (entries == NULL /* if entry->set is bogusly -1 */ || |
