From 410c2d0bcc144feb12f0d8a71338cd32edc4fcc9 Mon Sep 17 00:00:00 2001 From: tb <> Date: Sat, 31 May 2025 11:31:16 +0000 Subject: 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. --- src/lib/libcrypto/bio/bss_mem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/lib') 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 @@ -/* $OpenBSD: bss_mem.c,v 1.26 2025/05/24 19:45:34 tb Exp $ */ +/* $OpenBSD: bss_mem.c,v 1.27 2025/05/31 11:31:16 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -140,6 +140,7 @@ BIO_new_mem_buf(const void *buf, int buf_len) return NULL; bm = bio->ptr; + free(bm->buf->data); bm->buf->data = (void *)buf; /* Trust in the BIO_FLAGS_MEM_RDONLY flag. */ bm->buf->length = buf_len; bm->buf->max = buf_len; -- cgit v1.2.3-55-g6feb