From: tb Date: Sun, 13 Mar 2022 16:25:58 +0000 (+0000) Subject: Add missing error check after strdup() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=018cf829d0a605f2ebfc6fa4a4f37b5474e5a26e;p=openbsd Add missing error check after strdup() From Alex Wilson ok jsing --- diff --git a/lib/libcrypto/x509/x509_constraints.c b/lib/libcrypto/x509/x509_constraints.c index c7adaa4b368..6cea7945606 100644 --- a/lib/libcrypto/x509/x509_constraints.c +++ b/lib/libcrypto/x509/x509_constraints.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_constraints.c,v 1.21 2022/03/03 11:29:05 tb Exp $ */ +/* $OpenBSD: x509_constraints.c,v 1.22 2022/03/13 16:25:58 tb Exp $ */ /* * Copyright (c) 2020 Bob Beck * @@ -949,7 +949,10 @@ x509_constraints_validate(GENERAL_NAME *constraint, case GEN_URI: if (!x509_constraints_valid_domain_constraint(bytes, len)) goto err; - name->name = strdup(bytes); + if ((name->name = strdup(bytes)) == NULL) { + *error = X509_V_ERR_OUT_OF_MEM; + return 0; + } name->type = GEN_URI; break; default: