diff options
author | tb <> | 2025-05-31 11:31:16 +0000 |
---|---|---|
committer | tb <> | 2025-05-31 11:31:16 +0000 |
commit | ea9404b605359819ecc0a8eedda0542c5e65d924 (patch) | |
tree | 5ffbc57a489508b6426ed4e7fd8dc4c1ceaf73b1 /src | |
parent | dd12fa86b5201ea39cbf2e5df31e9e650557bf19 (diff) | |
download | openbsd-ea9404b605359819ecc0a8eedda0542c5e65d924.tar.gz openbsd-ea9404b605359819ecc0a8eedda0542c5e65d924.tar.bz2 openbsd-ea9404b605359819ecc0a8eedda0542c5e65d924.zip |
Plug leak of bm->buf->data
BIO_new(BIO_s_mem()) now allocates this pointer, so we need to free it
before assigning to it.
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/bio/bss_mem.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lib/libcrypto/bio/bss_mem.c b/src/lib/libcrypto/bio/bss_mem.c index f977a123a7..0fa6317a2b 100644 --- a/src/lib/libcrypto/bio/bss_mem.c +++ b/src/lib/libcrypto/bio/bss_mem.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bss_mem.c,v 1.26 2025/05/24 19:45:34 tb Exp $ */ | 1 | /* $OpenBSD: bss_mem.c,v 1.27 2025/05/31 11:31:16 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 | * |
@@ -140,6 +140,7 @@ BIO_new_mem_buf(const void *buf, int buf_len) | |||
140 | return NULL; | 140 | return NULL; |
141 | 141 | ||
142 | bm = bio->ptr; | 142 | bm = bio->ptr; |
143 | free(bm->buf->data); | ||
143 | bm->buf->data = (void *)buf; /* Trust in the BIO_FLAGS_MEM_RDONLY flag. */ | 144 | bm->buf->data = (void *)buf; /* Trust in the BIO_FLAGS_MEM_RDONLY flag. */ |
144 | bm->buf->length = buf_len; | 145 | bm->buf->length = buf_len; |
145 | bm->buf->max = buf_len; | 146 | bm->buf->max = buf_len; |