openssl/apps
Bernd Edlinger 6c70934a46 Fix a possible memory leak in req_main
if the private key is output to stdout using the HARNESS_OSSL_PREFIX,
out is a stack of BIOs and must therefore free'd using BIO_free_all.

Steps to reproduce:

$ HARNESS_OSSL_PREFIX=x OPENSSL_CONF=apps/openssl.cnf util/shlib_wrap.sh apps/openssl req -new -keyout - -passout pass: </dev/null
[...]
Direct leak of 128 byte(s) in 1 object(s) allocated from:
    #0 0x7f6f692b89cf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x7f6f686eda00 in CRYPTO_malloc crypto/mem.c:202
    #2 0x7f6f686edba0 in CRYPTO_zalloc crypto/mem.c:222
    #3 0x7f6f68471bdf in BIO_new_ex crypto/bio/bio_lib.c:83
    #4 0x7f6f68491a8f in BIO_new_fp crypto/bio/bss_file.c:95
    #5 0x555c5f58b378 in dup_bio_out apps/lib/apps.c:3014
    #6 0x555c5f58f9ac in bio_open_default_ apps/lib/apps.c:3175
    #7 0x555c5f58f9ac in bio_open_default apps/lib/apps.c:3203
    #8 0x555c5f528537 in req_main apps/req.c:683
    #9 0x555c5f50e315 in do_cmd apps/openssl.c:426
    #10 0x555c5f4c5575 in main apps/openssl.c:307
    #11 0x7f6f680461c9 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

SUMMARY: AddressSanitizer: 128 byte(s) leaked in 1 allocation(s).

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23365)

(cherry picked from commit ff78d94b13)
2024-01-24 11:55:30 +01:00
..
demoSRP Remove unnecessary trailing whitespace 2019-02-05 16:25:11 +01:00
include Update copyright year 2023-05-30 14:29:35 +02:00
lib Fix a possible memleak in opt_verify 2023-12-12 19:51:04 +01:00
CA.pl.in apps/CA.pl.in: restore the quotes around -CAfile, they were there for a reason 2021-06-26 06:43:09 +02:00
asn1parse.c find-doc-nits: Make -c option (cmd-nits) independent of app build and execution 2021-05-18 13:02:23 +02:00
build.info CMP test server: move apps/{,lib/}cmp_mock_srv.c and apps/{,include/}cmp_mock_srv.h 2021-05-20 16:23:27 +02:00
ca-cert.srl
ca-key.pem
ca-req.pem
ca.c Copyright year updates 2023-08-01 14:46:02 +01:00
cert.pem
ciphers.c Check that sk_SSL_CIPHER_value returns non-NULL value. 2022-09-20 18:27:53 +02:00
client.pem
cmp.c apps/cmp.c: fix bug not allowing to reset -csr and -serial option values 2023-09-05 21:06:29 +02:00
cms.c Fix a possible memleak in cms_main 2023-12-12 19:46:00 +01:00
crl.c Add support for ISO 8601 datetime format 2021-06-11 12:39:46 +02:00
crl2pkcs7.c find-doc-nits: Make -c option (cmd-nits) independent of app build and execution 2021-05-18 13:02:23 +02:00
ct_log_list.cnf Remove unnecessary trailing whitespace 2019-02-05 16:25:11 +01:00
dgst.c Fix some memory leaks in the openssl app 2023-09-21 14:40:45 +02:00
dhparam.c Copyright year updates 2023-10-24 14:47:21 +01:00
dsa-ca.pem
dsa-pca.pem
dsa.c Rename all getters to use get/get0 in name 2021-06-01 12:40:00 +02:00
dsa512.pem
dsa1024.pem
dsap.pem
dsaparam.c Copyright year updates 2023-10-24 14:47:21 +01:00
ec.c Update copyright year 2022-06-21 14:03:39 +01:00
ecparam.c APPS: ecparam: Support setting properties 2022-08-17 09:31:08 +02:00
enc.c enc: "bad decrypt" only in decryption 2023-09-20 08:12:48 +10:00
engine.c Update copyright year 2021-05-06 13:03:23 +01:00
errstr.c Fix some invalid use of sscanf 2023-12-12 16:13:08 +00:00
fipsinstall.c fipsinstall: use the app's libctx and property query when searching for algorithms 2021-06-15 18:26:47 +10:00
gendsa.c Copyright year updates 2023-10-24 14:47:21 +01:00
genpkey.c Copyright year updates 2023-10-24 14:47:21 +01:00
genrsa.c Copyright year updates 2023-10-24 14:47:21 +01:00
info.c Update copyright year 2021-05-06 13:03:23 +01:00
insta.ca.crt openssl-cmp.pod.in: Update and extend example using Insta Demo CA 2020-08-04 12:11:46 +02:00
kdf.c kdf: use the app's libctx and property query when searching for algorithms 2021-06-15 18:26:47 +10:00
list.c Make 'openssl list' less sensitive for providers without params 2023-12-04 15:17:42 +01:00
mac.c Update copyright year 2022-10-11 13:20:27 +01:00
nseq.c Update copyright year 2021-05-06 13:03:23 +01:00
ocsp.c apps/ocsp.c: Add missing test if make_ocsp_response failed 2022-11-15 12:00:45 +01:00
openssl-vms.cnf apps/openssl.cnf: fix reference to insta.ca.crt 2023-05-12 10:47:40 +02:00
openssl.c Update copyright year 2022-11-01 14:55:40 +01:00
openssl.cnf apps/openssl.cnf: fix reference to insta.ca.crt 2023-05-12 10:47:40 +02:00
passwd.c Update copyright year 2022-03-15 13:52:58 +00:00
pca-cert.srl
pca-key.pem
pca-req.pem
pkcs7.c APPS: Replace 'OPT_ERR = -1, OPT_EOF = 0, OPT_HELP' by OPT_COMMON macro 2021-05-05 20:48:20 +02:00
pkcs8.c Make the -inform option to be respected if possible 2021-05-06 11:43:32 +01:00
pkcs12.c Update copyright year 2022-10-11 13:20:27 +01:00
pkey.c Update copyright year 2023-02-07 12:59:59 +01:00
pkeyparam.c Update copyright year 2022-10-11 13:20:27 +01:00
pkeyutl.c Copyright year updates 2023-08-01 14:46:02 +01:00
prime.c Update copyright year 2021-05-06 13:03:23 +01:00
privkey.pem
progs.pl Update copyright year 2022-03-15 13:52:58 +00:00
rand.c APPS: Replace 'OPT_ERR = -1, OPT_EOF = 0, OPT_HELP' by OPT_COMMON macro 2021-05-05 20:48:20 +02:00
rehash.c Fix a possible memleak in apps/rehash.c 2023-12-12 19:49:32 +01:00
req.c Fix a possible memory leak in req_main 2024-01-24 11:55:30 +01:00
req.pem
rsa.c Add missing ')' to command help 2022-08-26 09:03:50 +10:00
rsa8192.pem Fix rsa8192.pem 2020-05-13 06:28:36 +02:00
rsautl.c Fix the checks in rsautl_main 2022-12-05 13:05:59 +01:00
s512-key.pem
s512-req.pem
s1024key.pem
s1024req.pem
s_client.c Copyright year updates 2023-08-01 14:46:02 +01:00
s_server.c Error in s_server when -rev option is used with dtls. 2024-01-15 16:35:00 +01:00
s_time.c s_time: avoid unlikely division by zero 2021-06-30 13:55:09 +10:00
server.pem Replace apps/server.pem with certificate with a sha256 signature. 2020-01-25 14:10:40 +01:00
server.srl
server2.pem
sess_id.c Update copyright year 2021-05-06 13:03:23 +01:00
smime.c Fix a possible memleak in smime_main 2023-12-12 19:47:51 +01:00
speed.c Added check for the return value of the RAND_bytes() function 2023-10-10 17:18:47 +02:00
spkac.c spkac: allow digests other than MD5 to be used for signing 2021-06-15 18:26:34 +10:00
srp.c openssl srp: make index.txt parsing error more verbose 2021-05-24 14:37:00 +02:00
storeutl.c Fix openssl storeutl to allow serial + issuer 2022-12-14 09:34:46 +01:00
testCA.pem
testdsa.h Replace OSSL_PARAM_BLD_free_params() with OSSL_PARAM_free(). 2021-04-12 16:55:30 +10:00
testrsa.h Following the license change, modify the boilerplates in apps/ 2018-12-06 14:15:27 +01:00
timeouts.h Fix header file include guard names 2019-09-28 20:26:36 +02:00
ts.c Fix the checks of X509_LOOKUP_* functions 2022-06-23 12:43:19 +02:00
tsget.in Update copyright year 2021-12-14 14:41:27 +00:00
verify.c Update copyright year 2022-03-15 13:52:58 +00:00
version.c Update copyright year 2021-05-06 13:03:23 +01:00
vms_decc_init.c VMS: move copy_argc to its own module and make it an aux source 2019-03-05 08:51:09 +01:00
x509.c apps/x509: add warnings for options ignored when -CA is not specified 2022-07-14 07:26:37 +01:00