]> granicus.if.org Git - mutt/commitdiff
Fix mutt_strncmp size comparison for 'uncolor header'.
authorKevin McCarthy <kevin@8t8.us>
Mon, 21 May 2018 20:33:14 +0000 (13:33 -0700)
committerKevin McCarthy <kevin@8t8.us>
Mon, 21 May 2018 20:33:14 +0000 (13:33 -0700)
Thanks to Fabian Groffen for pointing out the discrepancy.

mutt_extract_token() null-terminates the token,, so actually there is
no need to use "strncmp" for the comparison in this case.

However, since the token is being checked against Fields there is no
potential harm of a prefix match, so we should fix the number to be
consistent with the other token comparisons.

color.c

diff --git a/color.c b/color.c
index 48ca1f8d91c41a6d421b741152156c5a54c5ff6f..af979dfc70d710e1a85c7dff53506fb5a621b9a0 100644 (file)
--- a/color.c
+++ b/color.c
@@ -428,7 +428,7 @@ static int _mutt_parse_uncolor (BUFFER *buf, BUFFER *s, unsigned long data,
   }
   else if (mutt_strncmp (buf->data, "body", 4) == 0)
     list = &ColorBodyList;
-  else if (mutt_strncmp (buf->data, "header", 7) == 0)
+  else if (mutt_strncmp (buf->data, "header", 6) == 0)
     list = &ColorHdrList;
   else
   {