From 00860da2f053275442cc5475c52462df510fcaa3 Mon Sep 17 00:00:00 2001 From: Iliyan Malchev Date: Mon, 19 Sep 2016 22:16:19 -0700 Subject: [PATCH] init: account for "init.svc." prefix in IsValidName For each service ${service} described in a .rc file, init creates the property init.svc.${service}. This implies that service-name lengths are bound by the maximum size of a property. This patch accounts for the "init.svc." prefix and the maximum property-name length when validating a service name. Test: pass Change-Id: I32dffa37363b41a8211f7644600b81973d30a3b2 Signed-off-by: Iliyan Malchev --- init/service.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/service.cpp b/init/service.cpp index 22fb01342..685befd48 100644 --- a/init/service.cpp +++ b/init/service.cpp @@ -996,7 +996,7 @@ void ServiceParser::EndSection() { } bool ServiceParser::IsValidName(const std::string& name) const { - if (name.size() > 16) { + if (name.size() > PROP_NAME_MAX - sizeof("init.svc.")) { return false; } for (const auto& c : name) {