1 |
commit: 2b1392af2fe9e5dfc8eda2f19d896efdc41840bf |
2 |
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com> |
3 |
AuthorDate: Wed May 9 22:30:08 2018 +0000 |
4 |
Commit: William Hubbs <williamh <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed May 9 22:30:08 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=2b1392af |
7 |
|
8 |
Logger: only log printable characters and newlines |
9 |
|
10 |
X-Gentoo-Bug: 651412 |
11 |
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=651412 |
12 |
|
13 |
src/rc/rc-logger.c | 5 +++-- |
14 |
1 file changed, 3 insertions(+), 2 deletions(-) |
15 |
|
16 |
diff --git a/src/rc/rc-logger.c b/src/rc/rc-logger.c |
17 |
index 062ce3d9..1da3f59c 100644 |
18 |
--- a/src/rc/rc-logger.c |
19 |
+++ b/src/rc/rc-logger.c |
20 |
@@ -87,8 +87,9 @@ write_log(int logfd, const char *buffer, size_t bytes) |
21 |
} |
22 |
|
23 |
if (!in_escape) { |
24 |
- if (write(logfd, p++, 1) == -1) |
25 |
- eerror("write: %s", strerror(errno)); |
26 |
+ if (isprint((unsigned char) *p) || *p == '\n') |
27 |
+ if (write(logfd, p++, 1) == -1) |
28 |
+ eerror("write: %s", strerror(errno)); |
29 |
continue; |
30 |
} |