Replace BUF_strdup() call by OPENSSL_strdup() adding failure check in bss_acpt.c
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>
Wed, 3 Jun 2020 19:38:20 +0000 (21:38 +0200)
committerDr. David von Oheimb <David.von.Oheimb@siemens.com>
Tue, 9 Jun 2020 10:13:14 +0000 (12:13 +0200)
Add OPENSSL_strdup failure check to cpt_ctrl() in bss_acpt.c

Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/12036)

crypto/bio/bss_acpt.c

index 5a2cb50dfc39fe2e561602d8087a26b92e47606a..4461eae2333de5c906635ef9bb673c8656a32414 100644 (file)
@@ -434,8 +434,10 @@ static long acpt_ctrl(BIO *b, int cmd, long num, void *ptr)
                 b->init = 1;
             } else if (num == 1) {
                 OPENSSL_free(data->param_serv);
-                data->param_serv = BUF_strdup(ptr);
-                b->init = 1;
+                if ((data->param_serv = OPENSSL_strdup(ptr)) == NULL)
+                    ret = 0;
+                else
+                    b->init = 1;
             } else if (num == 2) {
                 data->bind_mode |= BIO_SOCK_NONBLOCK;
             } else if (num == 3) {