Skip to content

Commit 5548f14

Browse files
committed
Add config variable check and report error if it doesn't match the config var name format
1 parent fdbd8d0 commit 5548f14

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

mbed/mbed.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,6 +1442,9 @@ def __init__(self, path):
14421442

14431443
# Sets config value
14441444
def set(self, var, val):
1445+
if not re.match(r'^([\w+-]+)$', var):
1446+
error("%s is invalid config variable name" % var)
1447+
14451448
fl = os.path.join(self.path, self.file)
14461449
try:
14471450
with open(fl) as f:

0 commit comments

Comments
 (0)