--- sendmail-8.13.3/sendmail/collect.c~ 2004-12-01 00:29:15.000000000 +0100 +++ sendmail-8.13.3/sendmail/collect.c 2005-03-08 09:43:40.848804648 +0100 @@ -15,6 +15,8 @@ SM_RCSID("@(#)$Id$") +#define MAXHDRZ 512 + static void eatfrom __P((char *volatile, ENVELOPE *)); static void collect_doheader __P((ENVELOPE *)); static SM_FILE_T *collect_dfopen __P((ENVELOPE *)); @@ -283,6 +285,7 @@ register ENVELOPE *e; bool rsetsize; { + int hdrz = 0; register SM_FILE_T *df; bool ignrdot; int dbto; @@ -613,6 +616,16 @@ mstate = MS_BODY; goto nextstate; } + + if (hdrz++>MAXHDRZ) + { + sm_syslog(LOG_NOTICE, e->e_id, + "excessive headers from %s during message collect", + CurHostName ? CurHostName : ""); + errno = 0; + usrerr("451 Stop this. You are lame."); + goto readerr; + } /* check for possible continuation line */ do