aboutsummaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/utils/qemurunner.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/utils/qemurunner.py')
-rw-r--r--meta/lib/oeqa/utils/qemurunner.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index 56249775616..9c878bc7075 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -13,6 +13,7 @@ import re
import socket
import select
import errno
+import string
import threading
from oeqa.utils.dump import HostDumper
@@ -61,6 +62,9 @@ class QemuRunner:
def log(self, msg):
if self.logfile:
+ # It is needed to sanitize the data received from qemu
+ # because is possible to have control characters or Unicode
+ msg = "".join(filter(lambda x:x in string.printable, msg))
with open(self.logfile, "a") as f:
f.write("%s" % msg)
@@ -170,6 +174,9 @@ class QemuRunner:
cmdline = ''
with open('/proc/%s/cmdline' % self.qemupid) as p:
cmdline = p.read()
+ # It is needed to sanitize the data received
+ # because is possible to have control characters
+ cmdline = "".join(filter(lambda x:x in string.printable, cmdline))
try:
ips = re.findall("((?:[0-9]{1,3}\.){3}[0-9]{1,3})", cmdline.split("ip=")[1])
if not ips or len(ips) != 3: