From a8230b7464e7fe71a551a0c987f5b994eab36e93 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Tue, 29 Oct 2019 12:08:23 -0500 Subject: hscript: Use string instead of regex for hostname validation --- hscript/meta.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'hscript') diff --git a/hscript/meta.cc b/hscript/meta.cc index d935ca4..3b3ee3d 100644 --- a/hscript/meta.cc +++ b/hscript/meta.cc @@ -26,8 +26,8 @@ using namespace Horizon::Keys; Key *Hostname::parseFromData(const std::string &data, int lineno, int *errors, int *) { - std::regex valid_re("[A-Za-z0-9-_.]*"); - if(!std::regex_match(data, valid_re)) { + std::string valid_chars("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_."); + if(data.find_first_not_of(valid_chars) != std::string::npos) { if(errors) *errors += 1; output_error("installfile:" + std::to_string(lineno), "hostname: expected machine or DNS name", -- cgit v1.2.3-60-g2f50