summaryrefslogtreecommitdiffstats
path: root/lib/output.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/output.c')
-rw-r--r--lib/output.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/output.c b/lib/output.c
index d1a8d3b9..bfd43195 100644
--- a/lib/output.c
+++ b/lib/output.c
@@ -259,6 +259,21 @@ mp_state_enum mp_eval_check_default(const mp_check check) {
259 return result; 259 return result;
260} 260}
261 261
262// Remove troublesome symbols from plugin output
263char *sanitize_output_insitu(char *input) {
264 if (input == NULL) {
265 return input;
266 }
267
268 for (char *walker = input; *walker != '\0'; walker++) {
269 if (*walker == '|') {
270 *walker = ' ';
271 }
272 }
273
274 return input;
275}
276
262/* 277/*
263 * Generate output string for a mp_check object 278 * Generate output string for a mp_check object
264 * Non static to be available for testing functions 279 * Non static to be available for testing functions
@@ -299,6 +314,8 @@ char *mp_fmt_output(mp_check check) {
299 subchecks = subchecks->next; 314 subchecks = subchecks->next;
300 } 315 }
301 316
317 result = sanitize_output_insitu(result);
318
302 if (pd_string != NULL && strlen(pd_string) > 0) { 319 if (pd_string != NULL && strlen(pd_string) > 0) {
303 asprintf(&result, "%s|%s", result, pd_string); 320 asprintf(&result, "%s|%s", result, pd_string);
304 } 321 }