svn commit: r253680 - in head: lib/libfetch usr.bin/fetch

Ulrich Spörlein uqs at FreeBSD.org
Thu Aug 8 16:34:54 UTC 2013


On Fri, 2013-07-26 at 15:53:43 +0000, Dag-Erling SmÞrgrav wrote:
> Modified: head/lib/libfetch/common.c
> ==============================================================================
> --- head/lib/libfetch/common.c	Fri Jul 26 14:43:38 2013	(r253679)
> +++ head/lib/libfetch/common.c	Fri Jul 26 15:53:43 2013	(r253680)
> +static struct addrinfo *
> +fetch_ssl_get_numeric_addrinfo(const char *hostname, size_t len)
> +{
> +	struct addrinfo hints, *res;
> +	char *host;
> +
> +	host = (char *)malloc(len + 1);
> +	memcpy(host, hostname, len);
> +	host[len] = '\0';
> +	memset(&hints, 0, sizeof(hints));
> +	hints.ai_family = PF_UNSPEC;
> +	hints.ai_socktype = SOCK_STREAM;
> +	hints.ai_protocol = 0;
> +	hints.ai_flags = AI_NUMERICHOST;
> +	/* port is not relevant for this purpose */
> +	getaddrinfo(host, "443", &hints, &res);

We check the return value for getaddrinfo() 210 out of 217 times in our
tree, please check it here too. Thanks! CID 1061016

> +static int
> +fetch_ssl_setup_peer_verification(SSL_CTX *ctx, int verbose)
> +{
> +	X509_LOOKUP *crl_lookup;
> +	X509_STORE *crl_store;
> +	const char *ca_cert_file, *ca_cert_path, *crl_file;
> +
> +	if (getenv("SSL_NO_VERIFY_PEER") == NULL) {
> +		ca_cert_file = getenv("SSL_CA_CERT_FILE") != NULL ?
> +		    getenv("SSL_CA_CERT_FILE") : "/etc/ssl/cert.pem";
> +		ca_cert_path = getenv("SSL_CA_CERT_PATH");
> +		if (verbose) {
> +			fetch_info("Peer verification enabled");
> +			if (ca_cert_file != NULL)
> +				fetch_info("Using CA cert file: %s",
> +				    ca_cert_file);
> +			if (ca_cert_path != NULL)
> +				fetch_info("Using CA cert path: %s",
> +				    ca_cert_path);
> +		}
> +		SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER,
> +		    fetch_ssl_cb_verify_crt);

The return value is unchecked here. Coverity claims we check it 4 out of
5 times in our tree, please fix this one too. CID 1061015


Cheers,
Uli


More information about the svn-src-all mailing list