From 888e8a3c511326e57357550e700f58dd80495a9d Mon Sep 17 00:00:00 2001 From: anders_k Date: Thu, 7 Oct 2021 14:45:52 +0000 Subject: [PATCH] Fixed halibut fprintf format security warnings (patch #304) git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7338 212acab6-be3b-0410-9dea-997c60f758d6 --- Docs/src/bin/halibut/bk_xhtml.c | 108 ++++++++++++++++---------------- Docs/src/history.but | 6 +- 2 files changed, 59 insertions(+), 55 deletions(-) diff --git a/Docs/src/bin/halibut/bk_xhtml.c b/Docs/src/bin/halibut/bk_xhtml.c index 8e1e97f0..95e41e20 100644 --- a/Docs/src/bin/halibut/bk_xhtml.c +++ b/Docs/src/bin/halibut/bk_xhtml.c @@ -903,22 +903,22 @@ static char *xhtml_index_filename = "IndexPage.html"; static void xhtml_donavlinks(FILE * fp, xhtmlfile * file) { xhtmlfile *xhtml_next_file = NULL; - fprintf(fp, "", conf.nav_attrs); } else { - fprintf(fp, ">"); + fputs(">", fp); } if (xhtml_last_file == NULL) { - fprintf(fp, "Previous | "); + fputs("Previous | ", fp); } else { fprintf(fp, "Previous | ", xhtml_last_file->filename); } - fprintf(fp, "Contents | "); + fputs("Contents | ", fp); if (file != NULL) { /* otherwise we're doing nav links for the index */ if (xhtml_next_file == NULL) @@ -932,7 +932,7 @@ static void xhtml_donavlinks(FILE * fp, xhtmlfile * file) { if (file == NULL) { /* index, so no next file */ - fprintf(fp, "Next "); + fputs("Next ", fp); } else { fprintf(fp, "Next", xhtml_index_filename); @@ -941,7 +941,7 @@ static void xhtml_donavlinks(FILE * fp, xhtmlfile * file) { fprintf(fp, "Next", xhtml_next_file->filename); } - fprintf(fp, "

\n"); + fputs("

\n", fp); } /* Write out the index file */ @@ -953,7 +953,7 @@ static void xhtml_do_index_body(FILE * fp) if (count234(idx->entries) == 0) return; /* don't write anything at all */ - fprintf(fp, "
\n"); + fputs("
\n", fp); /* iterate over idx->entries using the tree functions and display everything */ for (ti = 0; (y = (indexentry *) index234(idx->entries, ti)) != NULL; ti++) @@ -963,9 +963,9 @@ static void xhtml_do_index_body(FILE * fp) int i; xhtmlindex *xi; - fprintf(fp, "
"); + fputs("
", fp); xhtml_para(fp, y->text); - fprintf(fp, "
\n
"); + fputs("\n
", fp); xi = (xhtmlindex *) y->backend_data; for (i = 0; i < xi->nsection; i++) @@ -983,17 +983,17 @@ static void xhtml_do_index_body(FILE * fp) { xhtml_para(fp, sect->para->words); } - fprintf(fp, ""); + fputs("", fp); if (i + 1 < xi->nsection) { - fprintf(fp, ", "); + fputs(", ", fp); } } } - fprintf(fp, "
\n"); + fputs("\n", fp); } } - fprintf(fp, "
\n"); + fputs("
\n", fp); } static void xhtml_do_index() { @@ -1111,20 +1111,20 @@ static void xhtml_do_top_file(xhtmlfile * file, paragraph * sourceform) { if (p->type == para_Preamble) { - fprintf(fp, "

"); + fputs("

", fp); xhtml_hack_xhtmlify(p->words); xhtml_para(fp, p->words); - fprintf(fp, "

\n"); + fputs("

\n", fp); } } for (p = sourceform; p; p = p->next) { if (p->type == para_Copyright) { - fprintf(fp, "

"); + fputs("

", fp); xhtml_hack_xhtmlify(p->words); xhtml_para(fp, p->words); - fprintf(fp, "

\n"); + fputs("

\n", fp); } } @@ -1137,7 +1137,7 @@ static void xhtml_do_top_file(xhtmlfile * file, paragraph * sourceform) */ if (conf.leaf_level == 0 && count234(idx->entries) > 0) { - fprintf(fp, "

Index

\n"); + fputs("

Index

\n", fp); xhtml_do_index_body(fp); } @@ -1198,7 +1198,7 @@ static int xhtml_do_contents(FILE * fp, xhtmlfile * file) while (last_level > start_level) { last_level--; - fprintf(fp, "\n"); + fputs("\n", fp); if(chm_toc)fprintf(chm_toc, "\n"); } } @@ -1223,7 +1223,7 @@ static int xhtml_do_naked_contents(FILE * fp, xhtmlfile * file) while (last_level > start_level) { last_level--; - fprintf(fp, "\n"); + fputs("\n", fp); if(chm_toc)fprintf(chm_toc, "\n"); } } @@ -1303,13 +1303,13 @@ xhtml_add_contents_entry(FILE * fp, xhtmlsection * section, int limit) while (last_level > section->level) { last_level--; - fprintf(fp, "\n"); + fputs("\n", fp); if(chm_toc)fprintf(chm_toc, "\n"); } while (last_level < section->level) { last_level++; - fprintf(fp, "