Przeglądaj źródła

Make more effort to escape < > & in HTML

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@32842 15284696-431f-4ddb-bdfa-cd5b030d7da7
Glynn Clements 17 lat temu
rodzic
commit
3ac200ff96
1 zmienionych plików z 10 dodań i 6 usunięć
  1. 10 6
      lib/gis/parser.c

+ 10 - 6
lib/gis/parser.c

@@ -1649,7 +1649,7 @@ static void G_usage_html(void)
 
 	    if (opt->label) {
 		fprintf(stdout, "<DD>");
-		fprintf(stdout, "%s", opt->label);
+		print_escaped_for_html(stdout, opt->label);
 		fprintf(stdout, "</DD>\n");
 	    }
 	    if (opt->description) {
@@ -1660,13 +1660,13 @@ static void G_usage_html(void)
 
 	    if (opt->options) {
 		fprintf(stdout, "<DD>%s: <em>", _("Options"));
-		fprintf(stdout, "%s", opt->options);
+		print_escaped_for_html(stdout, opt->options);
 		fprintf(stdout, "</em></DD>\n");
 	    }
 
 	    if (opt->def) {
 		fprintf(stdout, "<DD>%s: <em>", _("Default"));
-		fprintf(stdout, "%s", opt->def);
+		print_escaped_for_html(stdout, opt->def);
 		fprintf(stdout, "</em></DD>\n");
 	    }
 
@@ -1674,9 +1674,13 @@ static void G_usage_html(void)
 		int i = 0;
 
 		while (opt->opts[i]) {
-		    if (opt->descs[i])
-			fprintf(stdout, "<DD><b>%s</b>: %s</DD>\n",
-				opt->opts[i], opt->descs[i]);
+		    if (opt->descs[i]) {
+			fprintf(stdout, "<DD><b>");
+			print_escaped_for_html(stdout, opt->opts[i]);
+			fprintf(stdout, "</b>: ");
+			print_escaped_for_html(stdout, opt->descs[i]);
+			fprintf(stdout, "</DD>\n");
+		    }
 		    i++;
 		}
 	    }