Module: check_mk
Branch: master
Commit: 9fb4d0c29ebc1cddac67b7804ed08161c80ba1a7
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9fb4d0c29ebc1c…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue May 16 15:04:37 2017 +0200
livestatus: Use safer eval when processing python data structures received via livestatus
Change-Id: I87c74842f5f8309b164e3d7f9436cb25e5600089
---
livestatus/api/python/livestatus.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/livestatus/api/python/livestatus.py b/livestatus/api/python/livestatus.py
index 7a5a6d2..63a95cb 100644
--- a/livestatus/api/python/livestatus.py
+++ b/livestatus/api/python/livestatus.py
@@ -25,6 +25,7 @@
# Boston, MA 02110-1301 USA.
import socket, time, re, os
+import ast
"""MK Livestatus Python API"""
@@ -338,7 +339,7 @@ class BaseConnection:
data = self.receive_data(length)
if code == "200":
try:
- return eval(data)
+ return ast.literal_eval(data)
except:
raise MKLivestatusSocketError("Malformed output")
else: