提交 e565d934 编写于 作者: M Markus Armbruster

qapi: Fix to reject stray 't', 'f' and 'n'

Screwed up in commit e53188ad.
Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
Reviewed-by: NEric Blake <eblake@redhat.com>
上级 a1366087
......@@ -217,20 +217,18 @@ class QAPISchema:
return
else:
string += ch
elif self.tok in "tfn":
val = self.src[self.cursor - 1:]
if val.startswith("true"):
self.val = True
self.cursor += 3
return
elif val.startswith("false"):
self.val = False
self.cursor += 4
return
elif val.startswith("null"):
self.val = None
self.cursor += 3
return
elif self.src.startswith("true", self.pos):
self.val = True
self.cursor += 3
return
elif self.src.startswith("false", self.pos):
self.val = False
self.cursor += 4
return
elif self.src.startswith("null", self.pos):
self.val = None
self.cursor += 3
return
elif self.tok == '\n':
if self.cursor == len(self.src):
self.tok = None
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册