From 88378c535e0191dd6c8a03759f333f39550fc983 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Mon, 14 Oct 2019 12:43:26 -0500 Subject: hscript: Assert instead of validate in Hostname::execute --- hscript/meta.cc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/hscript/meta.cc b/hscript/meta.cc index 4d051f4..e1f7b2f 100644 --- a/hscript/meta.cc +++ b/hscript/meta.cc @@ -10,6 +10,7 @@ * SPDX-License-Identifier: AGPL-3.0-only */ +#include #include #include #include @@ -75,12 +76,7 @@ bool Hostname::execute(ScriptOptions opts) const { /* Linux has a nodename limit of 64 characters. * That's fine, because we have a limit of 64 chars per segment. * Assuming a dot is present, just chop at the first dot. */ - if(dot == std::string::npos || dot >= 64) { - output_error("installfile:" + std::to_string(this->lineno()), - "hostname: nodename too long", - "Linux requires nodename to be <= 64 characters."); - return false; - } + assert(dot <= 64); actual = this->_value.substr(0, dot); } else { actual = this->_value; -- cgit v1.2.3-70-g09d2