summaryrefslogtreecommitdiff
path: root/hscript
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-24 01:29:29 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-24 01:29:29 -0500
commit725e3f9f0c401aa34bb0d3d01bb8119797d038f7 (patch)
treeb0c50230f073208d9c31e9e181c50deee74a4d72 /hscript
parent240ff8c1d9e5b03d27804490767c15b7877305a2 (diff)
downloadhorizon-725e3f9f0c401aa34bb0d3d01bb8119797d038f7.tar.gz
horizon-725e3f9f0c401aa34bb0d3d01bb8119797d038f7.tar.bz2
horizon-725e3f9f0c401aa34bb0d3d01bb8119797d038f7.tar.xz
horizon-725e3f9f0c401aa34bb0d3d01bb8119797d038f7.zip
hscript: Ensure netaddress iface name is < IFNAMSIZ
Diffstat (limited to 'hscript')
-rw-r--r--hscript/network.cc7
1 files changed, 7 insertions, 0 deletions
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;