From 10dc54bd89f090d10fda1c9e69417b94a0ab7e03 Mon Sep 17 00:00:00 2001 From: Stefan Ritt Date: Fri, 7 Jun 2002 14:40:37 +0000 Subject: [PATCH] Check URL tail before displaying logbook page SVN revision: 85 --- elogd.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/elogd.c b/elogd.c index f2c5a0ba..5b054290 100755 --- a/elogd.c +++ b/elogd.c @@ -6,6 +6,9 @@ Contents: Web server program for Electronic Logbook ELOG $Log$ + Revision 2.4 2002/06/07 14:40:37 midas + Check URL tail before displaying logbook page + Revision 2.3 2002/06/07 14:22:00 midas Workaround for Konqueror browser @@ -5534,10 +5537,10 @@ LOGBOOK *lbs_dest; /*------------------------------------------------------------------*/ -void show_elog_page(LOGBOOK *lbs, int message_id) +void show_elog_page(LOGBOOK *lbs, char *dec_path) { int size, i, j, len, n, status, fh, length, message_error, index, n_attr; -int orig_message_id; +int message_id, orig_message_id; char str[256], command[80], ref[256], file_name[256], attrib[MAX_N_ATTR][NAME_LENGTH]; char date[80], text[TEXT_SIZE], menu_str[1000], other_str[1000], cmd[256], orig_tag[80], reply_tag[80], attachment[MAX_ATTACHMENTS][256], encoding[80], att[256], lattr[256]; @@ -5546,6 +5549,8 @@ char menu_item[MAX_N_LIST][NAME_LENGTH], format[80], FILE *f; BOOL first; + message_id = atoi(dec_path); + n_attr = scan_attributes(lbs->name); if (getcfg(lbs->name, "Types", str)) @@ -5723,6 +5728,13 @@ BOOL first; if (equal_ustring(command, loc("Search"))) { + if (dec_path[0] && atoi(dec_path) == 0) + { + sprintf(str, "Invalid URL: %s", dec_path); + show_error(str); + return; + } + show_elog_submit_find(lbs, 0, 0); return; } @@ -5923,6 +5935,15 @@ BOOL first; return; } + /*---- check for valid URL ---------------------------------------*/ + + if (dec_path[0] && atoi(dec_path) == 0) + { + sprintf(str, "Invalid URL: %s", dec_path); + show_error(str); + return; + } + /*---- get current message ---------------------------------------*/ if (message_id == 0) @@ -7128,7 +7149,7 @@ LOGBOOK *cur_lb; return; } - show_elog_page(cur_lb, atoi(dec_path)); + show_elog_page(cur_lb, dec_path); return; }