From c2819fbfcf6f9286ba664a9d31754d5d5e061f12 Mon Sep 17 00:00:00 2001 From: drochner Date: Thu, 13 Aug 2009 17:55:18 +0000 Subject: [PATCH] avoid NULL dereference in log output if the command line parser failed to extract a port number from the URL --- usr.bin/ftp/fetch.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/usr.bin/ftp/fetch.c b/usr.bin/ftp/fetch.c index 21909436a163..54a1ccca1f27 100644 --- a/usr.bin/ftp/fetch.c +++ b/usr.bin/ftp/fetch.c @@ -1,4 +1,4 @@ -/* $NetBSD: fetch.c,v 1.188 2009/07/13 19:05:41 roy Exp $ */ +/* $NetBSD: fetch.c,v 1.189 2009/08/13 17:55:18 drochner Exp $ */ /*- * Copyright (c) 1997-2009 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #include #ifndef lint -__RCSID("$NetBSD: fetch.c,v 1.188 2009/07/13 19:05:41 roy Exp $"); +__RCSID("$NetBSD: fetch.c,v 1.189 2009/08/13 17:55:18 drochner Exp $"); #endif /* not lint */ /* @@ -1498,7 +1498,8 @@ fetch_ftp(const char *url) autologin = oautologin; if ((connected == 0) || (connected == 1 && !ftp_login(host, uuser, pass))) { - warnx("Can't connect or login to host `%s:%s'", host, port); + warnx("Can't connect or login to host `%s:%s'", + host, port ? port : "?"); goto cleanup_fetch_ftp; }