# 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]); }