From 213e1a65b6e052fa8557732aaf0f9dfe3a7461c2 Mon Sep 17 00:00:00 2001 From: Stefan Ritt Date: Thu, 23 Jul 2009 06:27:47 +0000 Subject: [PATCH] Fixed problem with invalid encoding SVN revision: 2234 --- src/elogd.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/elogd.c b/src/elogd.c index a4e6662e..6653ab02 100755 --- a/src/elogd.c +++ b/src/elogd.c @@ -21931,7 +21931,12 @@ void submit_elog(LOGBOOK * lbs) else allowed_encoding = 7; - strcpy(encoding, isparam("encoding") ? getparam("encoding") : "plain"); + strlcpy(encoding, isparam("encoding") ? getparam("encoding") : "plain", sizeof(encoding)); + + /* check for valid encoding */ + if (!strieq(encoding, "plain") && !strieq(encoding, "ELCode") && + !strieq(encoding, "HTML")) + strcpy(encoding, "plain"); if (strieq(encoding, "plain") && (allowed_encoding & 1) == 0) { show_error("Plain encoding not allowed"); @@ -23798,16 +23803,16 @@ void show_elog_entry(LOGBOOK * lbs, char *dec_path, char *command) if (show_text) { rsprintf(""); - if (strieq(encoding, "plain")) { - rsputs("
");
-            rsputs2(lbs, email, text);
-            rsputs("
"); - } else if (strieq(encoding, "ELCode")) - rsputs_elcode(lbs, email, text); - else { + if (strieq(encoding, "html")) { if (email) replace_inline_img(lbs, text); rsputs(text); + } else if (strieq(encoding, "ELCode")) { + rsputs_elcode(lbs, email, text); + } else { + rsputs("
");
+            rsputs2(lbs, email, text);
+            rsputs("
"); } rsputs("\n");