summaryrefslogtreecommitdiff
path: root/src/basic/string-util.h
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-05-17 11:09:07 +0200
committerSven Eden <yamakuzure@gmx.net>2018-08-24 16:47:08 +0200
commit226fcafbbecd2b988eb24b39a3e97c9cf24e1167 (patch)
treeb8094441c89d115aa0c7b5d517dac6d5877fcee2 /src/basic/string-util.h
parent0d3fd8ae03eb180e1309f8b0bfd2fbce6c3cfdcc (diff)
basic/journal-importer: escape & ellipsize bad data in log entries
We shouldn't just log arbitrary stuff, in particular newlines and control chars Now: Unknown dunder line __CURSORFACILITY=6\nSYSLOG_IDENTIFIER=/USR/SBIN/CRON\nMES…, ignoring. Unknown dunder line __REALTIME_TIME[TAMP=1404101101501874\n__MONOTONIC_TIMEST…, ignoring.
Diffstat (limited to 'src/basic/string-util.h')
-rw-r--r--src/basic/string-util.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/basic/string-util.h b/src/basic/string-util.h
index 99b515569..7ee9aef70 100644
--- a/src/basic/string-util.h
+++ b/src/basic/string-util.h
@@ -167,6 +167,9 @@ char *ellipsize_mem(const char *s, size_t old_length_bytes, size_t new_length_co
char *ellipsize(const char *s, size_t length, unsigned percent);
char *cellescape(char *buf, size_t len, const char *s);
+/* This limit is arbitrary, enough to give some idea what the string contains */
+#define CELLESCAPE_DEFAULT_LENGTH 64
+
bool nulstr_contains(const char *nulstr, const char *needle);
char* strshorten(char *s, size_t l);