11/*
2- * iperf, Copyright (c) 2014-2023 , The Regents of the University of
2+ * iperf, Copyright (c) 2014-2026 , The Regents of the University of
33 * California, through Lawrence Berkeley National Laboratory (subject
44 * to receipt of any required approvals from the U.S. Dept. of
55 * Energy). All rights reserved.
@@ -188,7 +188,12 @@ EVP_PKEY *load_pubkey_from_file(const char *file) {
188188EVP_PKEY * load_pubkey_from_base64 (const char * buffer ) {
189189 unsigned char * key = NULL ;
190190 size_t key_len ;
191- Base64Decode (buffer , & key , & key_len );
191+ int bd ;
192+
193+ bd = Base64Decode (buffer , & key , & key_len );
194+ if (bd < 0 ) {
195+ return NULL ;
196+ }
192197
193198 BIO * bio = BIO_new (BIO_s_mem ());
194199 BIO_write (bio , key , key_len );
@@ -215,7 +220,12 @@ EVP_PKEY *load_privkey_from_file(const char *file) {
215220EVP_PKEY * load_privkey_from_base64 (const char * buffer ) {
216221 unsigned char * key = NULL ;
217222 size_t key_len ;
218- Base64Decode (buffer , & key , & key_len );
223+ int bd ;
224+
225+ bd = Base64Decode (buffer , & key , & key_len );
226+ if (bd < 0 ) {
227+ return NULL ;
228+ }
219229
220230 BIO * bio = BIO_new (BIO_s_mem ());
221231 BIO_write (bio , key , key_len );
@@ -408,7 +418,12 @@ int decode_auth_setting(int enable_debug, const char *authtoken, EVP_PKEY *priva
408418 unsigned char * encrypted_b64 = NULL ;
409419 size_t encrypted_len_b64 ;
410420 int64_t utc_seconds = 0 ;
411- Base64Decode (authtoken , & encrypted_b64 , & encrypted_len_b64 );
421+ int bd ;
422+
423+ bd = Base64Decode (authtoken , & encrypted_b64 , & encrypted_len_b64 );
424+ if (bd < 0 ) {
425+ return -1 ;
426+ }
412427
413428 unsigned char * plaintext = NULL ;
414429 int plaintext_len ;
0 commit comments