Sophie

Sophie

distrib > Mandriva > 2007.0 > x86_64 > media > main-updates-src > by-pkgid > 5d2d8c71a0335c1ba5392d091861b370 > files > 8

mutt-1.5.11-5.2mdv2007.0.src.rpm

# HG changeset patch
# User Brendan Cully <brendan@kublai.com>
# Date 1178561955 25200
# Node ID 47d08903b79b78ce26516de97682b244d3573c47
# Parent  f6861b85f22b1656a870aeabad83a1bbd9794af9
Use signed arithmetic in mutt_gecos_name to avoid an overflow.
Closes #2885.

diff -r f6861b85f22b -r 47d08903b79b muttlib.c
--- a/muttlib.c	Wed May 02 10:50:07 2007 -0700
+++ b/muttlib.c	Mon May 07 11:19:15 2007 -0700
@@ -540,7 +540,7 @@ char *mutt_gecos_name (char *dest, size_
     if (dest[idx] == '&')
     {
       memmove (&dest[idx + pwnl], &dest[idx + 1],
-	       MAX(destlen - idx - pwnl - 1, 0));
+	       MAX((ssize_t)(destlen - idx - pwnl - 1), 0));
       memcpy (&dest[idx], pw->pw_name, MIN(destlen - idx - 1, pwnl));
       dest[idx] = toupper ((unsigned char) dest[idx]);
     }