From 6bc2290ee096c24340147b7fa70f6e59ab6858e7 Mon Sep 17 00:00:00 2001 From: Jason Gochanour Date: Thu, 28 Apr 2016 14:48:52 -0600 Subject: [PATCH 1/2] XSS Vulnerabilities Patch --- src/elogd.c | 67 +++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 52 insertions(+), 15 deletions(-) diff --git a/src/elogd.c b/src/elogd.c index 5afdfd4a..843a005e 100755 --- a/src/elogd.c +++ b/src/elogd.c @@ -10490,7 +10490,9 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL /*---- add password in case cookie expires during edit ----*/ if (getcfg(lbs->name, "Password file", str, sizeof(str)) && isparam("unm")) { - rsprintf("\n", getparam("unm")); + /* XSS fix: Jason Gochanour */ + strencode2(str, getparam("unm"), sizeof(str)); + rsprintf("\n", str); if (isparam("upwd")) strlcpy(upwd, getparam("upwd"), sizeof(upwd)); else @@ -10577,7 +10579,10 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL rsprintf("%s:", loc("Entry time")); rsprintf("%s\n", str); - rsprintf("\n", date); + + /* XSS fix: Jason Gochanour */ + strencode2(str, date, sizeof(str)); + rsprintf("\n", str); } if (_condition[0]) @@ -11839,7 +11844,9 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL thumb_ref[0] = 0; if (strlen(att[index]) < 14 || att[index][6] != '_' || att[index][13] != '_') { - rsprintf("Error: Invalid attachment \"%s\"
", att); + /* XSS fix: Jason Gochanour */ + strencode2(str, att[index], sizeof(str)); + rsprintf("Error: Invalid attachment \"%s\"
", str); } else { strlcpy(file_name, lbs->data_dir, sizeof(file_name)); @@ -11889,7 +11896,9 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL rsprintf("  \n"); /* ImageMagick available, so get image size */ - rsprintf("%s \n", att[index] + 14); + /* XSS fix: Jason Gochanour */ + strencode2(str, att[index], sizeof(str)); + rsprintf("%s \n", str + 14); if (chkext(file_name, ".pdf") || chkext(file_name, ".ps")) sprintf(cmd, "%s -format '%%wx%%h' '%s[0]'", _identify_cmd, file_name); else @@ -12006,10 +12015,12 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL rsprintf("\n"); } + /* XSS fix: Jason Gochanour */ + strencode2(str, att[index], sizeof(str)); if (thumb_ref[0]) - rsprintf("\n", index, thumb_ref, att[index]); + rsprintf("\n", index, thumb_ref, str); else - rsprintf("\n", index, att[index]); + rsprintf("\n", index, str); rsprintf("\n"); } else @@ -13739,7 +13750,9 @@ void show_config_page(LOGBOOK * lbs) rsprintf("