diff options
| author | tb <> | 2025-03-20 09:41:47 +0000 |
|---|---|---|
| committer | tb <> | 2025-03-20 09:41:47 +0000 |
| commit | c909f83f696a43dda85d0bb327b00808387784cd (patch) | |
| tree | 025c3390b926542211a318ab4397f649439afb4b /src | |
| parent | 46618ac67e5680cdfb18cfaaf83e9cf4e0ba34c6 (diff) | |
| download | openbsd-c909f83f696a43dda85d0bb327b00808387784cd.tar.gz openbsd-c909f83f696a43dda85d0bb327b00808387784cd.tar.bz2 openbsd-c909f83f696a43dda85d0bb327b00808387784cd.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 */ || |
