From 725e3f9f0c401aa34bb0d3d01bb8119797d038f7 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Thu, 24 Oct 2019 01:29:29 -0500 Subject: hscript: Ensure netaddress iface name is < IFNAMSIZ --- hscript/network.cc | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'hscript') diff --git a/hscript/network.cc b/hscript/network.cc index b751e7e..e8f27b9 100644 --- a/hscript/network.cc +++ b/hscript/network.cc @@ -62,6 +62,13 @@ Key *NetAddress::parseFromData(const std::string &data, int lineno, int *errors, type_pos = data.find_first_of(' '); iface = data.substr(0, type_pos); + if(iface.length() > IFNAMSIZ) { + if(errors) *errors += 1; + output_error("installfile:" + std::to_string(lineno), + "netaddress: interface name '" + iface + "' is invalid", + "interface names must be 16 characters or less"); + return nullptr; + } /* theory: addr_pos could be npos, but that means 'read to end' anyway */ addr_pos = data.find_first_of(' ', type_pos + 1); if(addr_pos == std::string::npos) next_end = std::string::npos; -- cgit v1.2.3-70-g09d2