encode the name, it could contain XML entities
authorHiltjo Posthuma <hiltjo@codemadness.org>
Tue, 16 Nov 2021 10:44:23 +0000 (11:44 +0100)
committerHiltjo Posthuma <hiltjo@codemadness.org>
Tue, 16 Nov 2021 10:44:23 +0000 (11:44 +0100)
Like ", which would unquote the attribute value. Crazy but true.

stagit.c

index d8fbc642c166b06f33e0ec014647a2b363d6804a..d6376910b4a18855bb0e86c885d2b687cf5decea 100644 (file)
--- a/stagit.c
+++ b/stagit.c
@@ -480,10 +480,12 @@ writeheader(FILE *fp, const char *title)
                fputs(" - ", fp);
        xmlencode(fp, description, strlen(description));
        fprintf(fp, "</title>\n<link rel=\"icon\" type=\"image/png\" href=\"%sfavicon.png\" />\n", relpath);
-       fprintf(fp, "<link rel=\"alternate\" type=\"application/atom+xml\" title=\"%s Atom Feed\" href=\"%satom.xml\" />\n",
-               name, relpath);
-       fprintf(fp, "<link rel=\"alternate\" type=\"application/atom+xml\" title=\"%s Atom Feed (tags)\" href=\"%stags.xml\" />\n",
-               name, relpath);
+       fputs("<link rel=\"alternate\" type=\"application/atom+xml\" title=\"", fp);
+       xmlencode(fp, name, strlen(name));
+       fprintf(fp, " Atom Feed\" href=\"%satom.xml\" />\n", relpath);
+       fputs("<link rel=\"alternate\" type=\"application/atom+xml\" title=\"", fp);
+       xmlencode(fp, name, strlen(name));
+       fprintf(fp, " Atom Feed (tags)\" href=\"%stags.xml\" />\n", relpath);
        fprintf(fp, "<link rel=\"stylesheet\" type=\"text/css\" href=\"%sstyle.css\" />\n", relpath);
        fputs("</head>\n<body>\n<table><tr><td>", fp);
        fprintf(fp, "<a href=\"../%s\"><img src=\"%slogo.png\" alt=\"\" width=\"32\" height=\"32\" /></a>",