LGTM static code analysis tool reports that the function 'input' is
unsafe. Changed to use raw_input which then converts it using
ast.literal_eval() which is safe.
Fixes: d1b94da4a4e0 ("usertools: add client script for telemetry")
Cc: [email protected]
Signed-off-by: Andrius Sirvys <[email protected]>
Acked-by: Kevin Laatz <[email protected]>
---
v2:raw_input doesn't exist in Python 3, added a clause
to check python version
---
usertools/dpdk-telemetry-client.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/usertools/dpdk-telemetry-client.py
b/usertools/dpdk-telemetry-client.py
index ce0c7a9..5f6c47b 100755
--- a/usertools/dpdk-telemetry-client.py
+++ b/usertools/dpdk-telemetry-client.py
@@ -14,6 +14,11 @@
API_UNREG =
"{\"action\":2,\"command\":\"clients\",\"data\":{\"client_path\":\""
DEFAULT_FP = "/var/run/dpdk/default_client"
+try:
+ raw_input # Python 2
+except NameError:
+ raw_input = input # Python 3
+
class Socket:
def __init__(self):
--
2.7.4