diff options
Diffstat (limited to 'meta/lib/oeqa/utils/qemurunner.py')
-rw-r--r-- | meta/lib/oeqa/utils/qemurunner.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py index 5624977561..9c878bc707 100644 --- a/meta/lib/oeqa/utils/qemurunner.py +++ b/meta/lib/oeqa/utils/qemurunner.py | |||
@@ -13,6 +13,7 @@ import re | |||
13 | import socket | 13 | import socket |
14 | import select | 14 | import select |
15 | import errno | 15 | import errno |
16 | import string | ||
16 | import threading | 17 | import threading |
17 | from oeqa.utils.dump import HostDumper | 18 | from oeqa.utils.dump import HostDumper |
18 | 19 | ||
@@ -61,6 +62,9 @@ class QemuRunner: | |||
61 | 62 | ||
62 | def log(self, msg): | 63 | def log(self, msg): |
63 | if self.logfile: | 64 | if self.logfile: |
65 | # It is needed to sanitize the data received from qemu | ||
66 | # because is possible to have control characters or Unicode | ||
67 | msg = "".join(filter(lambda x:x in string.printable, msg)) | ||
64 | with open(self.logfile, "a") as f: | 68 | with open(self.logfile, "a") as f: |
65 | f.write("%s" % msg) | 69 | f.write("%s" % msg) |
66 | 70 | ||
@@ -170,6 +174,9 @@ class QemuRunner: | |||
170 | cmdline = '' | 174 | cmdline = '' |
171 | with open('/proc/%s/cmdline' % self.qemupid) as p: | 175 | with open('/proc/%s/cmdline' % self.qemupid) as p: |
172 | cmdline = p.read() | 176 | cmdline = p.read() |
177 | # It is needed to sanitize the data received | ||
178 | # because is possible to have control characters | ||
179 | cmdline = "".join(filter(lambda x:x in string.printable, cmdline)) | ||
173 | try: | 180 | try: |
174 | ips = re.findall("((?:[0-9]{1,3}\.){3}[0-9]{1,3})", cmdline.split("ip=")[1]) | 181 | ips = re.findall("((?:[0-9]{1,3}\.){3}[0-9]{1,3})", cmdline.split("ip=")[1]) |
175 | if not ips or len(ips) != 3: | 182 | if not ips or len(ips) != 3: |