]> granicus.if.org Git - mutt/commitdiff
Fix two places which _may_ look like buffer overflows, but aren't.
authorThomas Roessler <roessler@does-not-exist.org>
Mon, 29 Oct 2001 23:21:48 +0000 (23:21 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Mon, 29 Oct 2001 23:21:48 +0000 (23:21 +0000)
pager.c

diff --git a/pager.c b/pager.c
index aee946c3b6aaf262e235ff98a6dc9d93e916f902..62869f67e6c2f5e47766dc239b6c66189564e341 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -1410,6 +1410,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t *extra)
   static char searchbuf[STRING];
   char buffer[LONG_STRING];
   char helpstr[SHORT_STRING*2];
+  char tmphelp[SHORT_STRING*2];
   int maxLine, lastLine = 0;
   struct line_t *lineInfo;
   struct q_class_t *QuoteList = NULL;
@@ -1475,15 +1476,15 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t *extra)
   mutt_compile_help (helpstr, sizeof (helpstr), MENU_PAGER, PagerHelp);
   if (IsHeader (extra))
   {
+    strfcpy (tmphelp, helpstr, sizeof (tmphelp));
     mutt_compile_help (buffer, sizeof (buffer), MENU_PAGER, PagerHelpExtra);
-    strcat (helpstr, "  ");    /* __STRCAT_CHECKED__ */        /* we don't seem to have any user-supplied data here */
-    strcat (helpstr, buffer);  /* __STRCAT_CHECKED__ */
+    snprintf (helpstr, sizeof (helpstr), "%s %s", tmphelp, buffer);
   }
   if (!InHelp)
   {
+    strfcpy (tmphelp, helpstr, sizeof (tmphelp));
     mutt_make_help (buffer, sizeof (buffer), _("Help"), MENU_PAGER, OP_HELP);
-    strcat (helpstr, "  ");    /* __STRCAT_CHECKED__ */        /* we don't seem to have any user-supplied data here */
-    strcat (helpstr, buffer);  /* __STRCAT_CHECKED__ */
+    snprintf (helpstr, sizeof (helpstr), "%s %s", tmphelp, buffer);
   }
 
   while (ch != -1)