Ignore:
Timestamp:
2014-03-14T22:46:25+13:00 (10 years ago)
Author:
ak19
Message:

Third commit for security, for ensuring cgiargs macros are websafe. This time all the changes to the runtime action classes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/runtime-src/src/recpt/pageaction.cpp

    r28888 r28899  
    212212         
    213213          text_t link = "_gwcgi_?"+optsite+"a=p&p=about&c=" + *collist_here;
    214           link += "&l=" + args["l"] + "&w=" + args["w"];
     214          link += "&l=" + encodeForURL(args["l"]) + "&w=" + encodeForURL(args["w"]);
    215215
    216216          // We are "dynamically" overriding so to speak the
     
    335335          if (cinfo->isCollectGroup) {
    336336        link = "<a class=\"collectiontitle\" href=\"_gwcgi_?"+optsite+"a=p&amp;p=home&amp;g=" + *collist_here;
    337         link += "&amp;l=" + args["l"] + "&amp;w=" + args["w"] + "\">";
     337        link += "&amp;l=" + encodeForURL(args["l"]) + "&amp;w=" + encodeForURL(args["w"]) + "\">";
    338338          }
    339339          else {
    340340        link = "<a class=\"collectiontitle\" href=\"_gwcgi_?"+optsite+"a=p&amp;p=about&amp;c=" + *collist_here;
    341         link += "&amp;l=" + args["l"] + "&amp;w=" + args["w"] + "\">";
     341        link += "&amp;l=" + encodeForURL(args["l"]) + "&amp;w=" + encodeForURL(args["w"]) + "\">";
    342342          }
    343343         
     
    515515
    516516void pageaction::set_macro_to_file_contents (displayclass &disp, const text_t &macroname,
    517                          const text_t &packagename, const text_t &filename) {
     517                         const text_t &packagename, const text_t &filename, bool encode) {
    518518
    519519  text_t filecontent;
     
    531531    file_in.close();
    532532  }
     533
     534  // if we ever need to encode the contents into HTML, call this function with encode=true
     535  if(encode) {
     536    filecontent = encodeForHTML(filecontent);
     537  }
     538
    533539  disp.setmacro (macroname, packagename, dm_safe(filecontent));
    534540}
Note: See TracChangeset for help on using the changeset viewer.