core: reject VM names longer than 31 chars
This commit is contained in:
parent
7a5fc1357b
commit
98540ac513
@ -287,7 +287,8 @@ class QubesVm(object):
|
|||||||
|
|
||||||
if not self.verify_name(self.name):
|
if not self.verify_name(self.name):
|
||||||
raise QubesException("Invalid VM name (invalid characters, "
|
raise QubesException("Invalid VM name (invalid characters, "
|
||||||
"or one of 'none', 'true', 'false')")
|
"over 31 chars long, or one of 'none', "
|
||||||
|
"'true', 'false')")
|
||||||
|
|
||||||
if self.netvm is not None:
|
if self.netvm is not None:
|
||||||
self.netvm.connected_vms[self.qid] = self
|
self.netvm.connected_vms[self.qid] = self
|
||||||
@ -492,6 +493,8 @@ class QubesVm(object):
|
|||||||
def verify_name(self, name):
|
def verify_name(self, name):
|
||||||
if not isinstance(self.__basic_parse_xml_attr(name), str):
|
if not isinstance(self.__basic_parse_xml_attr(name), str):
|
||||||
return False
|
return False
|
||||||
|
if len(name) > 31:
|
||||||
|
return False
|
||||||
return re.match(r"^[a-zA-Z][a-zA-Z0-9_-]*$", name) is not None
|
return re.match(r"^[a-zA-Z][a-zA-Z0-9_-]*$", name) is not None
|
||||||
|
|
||||||
def pre_rename(self, new_name):
|
def pre_rename(self, new_name):
|
||||||
|
Loading…
Reference in New Issue
Block a user