rpc_cli: Avoid to use eval()
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
98a3b03792
commit
7e30cf6b01
@ -31,6 +31,7 @@
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import ast
|
||||
import cmd
|
||||
import signal
|
||||
import socket
|
||||
@ -139,9 +140,9 @@ class Cmd(cmd.Cmd):
|
||||
try:
|
||||
peer = args[0]
|
||||
method = args[1]
|
||||
params = eval(args[2])
|
||||
except:
|
||||
print("argument error")
|
||||
params = ast.literal_eval(args[2])
|
||||
except (IndexError, ValueError) as e:
|
||||
print("argument error: %s" % e)
|
||||
return
|
||||
try:
|
||||
p = peers[peer]
|
||||
|
Loading…
Reference in New Issue
Block a user