From 7d0726f55be1be5e2c31b2ce1caf120452268513 Mon Sep 17 00:00:00 2001 From: Ben Kibbey Date: Thu, 9 Apr 2009 21:10:35 -0400 Subject: [PATCH] Check for an empty (but not NULL) required parameter in init_tcp_conn(). --- src/libpwmd.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/libpwmd.c b/src/libpwmd.c index f91cc5e7..22255c77 100644 --- a/src/libpwmd.c +++ b/src/libpwmd.c @@ -342,18 +342,19 @@ static void _ssh_assuan_deinit(assuan_context_t ctx) * pwmd_ssh_connect_async(). */ static gpg_error_t init_tcp_conn(pwmd_tcp_conn_t **dst, const char *host, - int port, const char *identity, const char *user, const char *hosts, - int get) + int port, const char *identity, const char *user, + const char *known_hosts, int get) { pwmd_tcp_conn_t *conn; gpg_error_t rc = 0; if (get) { - if (!host) + if (!host || !*host) return GPG_ERR_INV_ARG; } else { - if (!host || !identity || !hosts) + if (!host || !*host || !identity || !*identity || !known_hosts || + !*known_hosts) return GPG_ERR_INV_ARG; } @@ -402,7 +403,7 @@ static gpg_error_t init_tcp_conn(pwmd_tcp_conn_t **dst, const char *host, } sprintf(conn->identity_pub, "%s.pub", conn->identity); - conn->known_hosts = pwmd_strdup(hosts); + conn->known_hosts = pwmd_strdup(known_hosts); if (!conn->known_hosts) { rc = gpg_error_from_errno(ENOMEM); -- 2.11.4.GIT