From: Stephen Morris Date: Mon, 12 Dec 2011 18:48:22 +0000 (+0000) Subject: [1470] Check for null filename before attempting to open master file X-Git-Tag: perftcpdns_before_epoll~5^2~24 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5dbdcfa0a3fdeab7b8757a8a22ff6d5b9cf87cbb;p=thirdparty%2Fkea.git [1470] Check for null filename before attempting to open master file --- diff --git a/src/lib/dns/masterload.cc b/src/lib/dns/masterload.cc index 5f7d5a009d..a32d4b70f7 100644 --- a/src/lib/dns/masterload.cc +++ b/src/lib/dns/masterload.cc @@ -40,8 +40,11 @@ void masterLoad(const char* const filename, const Name& origin, const RRClass& zone_class, MasterLoadCallback callback) { - ifstream ifs; + if ((filename == NULL) || (*filename == '\0')) { + isc_throw(MasterLoadError, "Name of master file must not be null"); + } + ifstream ifs; ifs.open(filename, ios_base::in); if (ifs.fail()) { isc_throw(MasterLoadError, "Failed to open master file: " << filename);