From c056a4415da4cfa7c0dfa135980513b773bfccea Mon Sep 17 00:00:00 2001 From: ru Date: Wed, 30 Dec 2009 23:01:49 +0000 Subject: Treat an empty argument as an error, instead of fetching the contents of the root directory. MFC after: 1 week --- usr.bin/fetch/fetch.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'usr.bin/fetch/fetch.c') diff --git a/usr.bin/fetch/fetch.c b/usr.bin/fetch/fetch.c index 2512a2e..7553bd8 100644 --- a/usr.bin/fetch/fetch.c +++ b/usr.bin/fetch/fetch.c @@ -340,6 +340,11 @@ fetch(char *URL, const char *path) fetchDebug = 1; /* parse URL */ + url = NULL; + if (*URL == '\0') { + warnx("empty URL"); + goto failure; + } if ((url = fetchParseURL(URL)) == NULL) { warnx("%s: parse error", URL); goto failure; -- cgit v1.1