--- procmail-3.22.orig/src/autoconf +++ procmail-3.22/src/autoconf @@ -1260,11 +1260,7 @@ host->h_length) { int j=host->h_length; const unsigned char*ad=(void*)host->h_0addr_list; - printf("#define IP_localhost {"); - printf("%d",*ad++); - while(--j) - printf(",%d",*ad++); - puts("}"); + puts("#define IP_localhost {127,0,0,1}"); } } #endif /* AF_INET */ --- procmail-3.22.orig/src/comsat.c +++ procmail-3.22/src/comsat.c @@ -92,7 +92,7 @@ } if(newvalid) /* so far, so good */ { int s; - if(!*chp) /* no service */ + if(!chad||!*chp) /* no service */ chp=BIFF_serviceport; /* new balls please! */ s=strtol(chp,&chad,10); if(chp!=chad) /* the service is not numeric */ @@ -120,7 +120,7 @@ { int s;const char*p; if(!csvalid||!buf) /* is comat on and set to a valid address? */ return; - if(!*cslgname||strlen(cslgname)+2>linebuf) /* is $LOGNAME bogus? */ + if(!cslgname||!*cslgname||strlen(cslgname)+2>linebuf)/* is $LOGNAME bogus? */ return; if(!(p=folder?folder:cslastf)) /* do we have a folder? */ return; --- procmail-3.22.orig/src/formail.c +++ procmail-3.22/src/formail.c @@ -758,9 +758,9 @@ lputssn(buf,buffilled),ctlength-=buffilled,buffilled=lnl=0; ;{ int tbl=buflast,lwr='\n'; while(--ctlength>=0&&tbl!=EOF) /* skip Content-Length: bytes */ - lnl=lwr==tbl&&lwr=='\n',putcs(lwr=tbl),tbl=getchar(); + lnl=lwr==tbl&&lwr=='\n',lputcs(lwr=tbl),tbl=getchar(); if((buflast=tbl)=='\n'&&lwr!=tbl) /* just before a line break? */ - putcs('\n'),buflast=getchar(); /* wrap up loose end */ + lputcs('\n'),buflast=getchar(); /* wrap up loose end */ } if(!quiet&&ctlength>0) { charNUM(num,ctlength); --- procmail-3.22.orig/src/header.h +++ procmail-3.22/src/header.h @@ -168,3 +168,5 @@ X(readreceiptto, "Read-Receipt-To:") /* miscellaneous extension */ X(fakesender, "Fake-Sender:") X(envelopeto, "Envelope-To:") /* exim extension */ +X(useragent, "User-Agent:") +X(nntppostingdate, "NNTP-Posting-Date:") --- procmail-3.22.orig/src/mailfold.c +++ procmail-3.22/src/mailfold.c @@ -378,7 +378,8 @@ dfilled=mailread=0; else if(rhead) /* only read in a new header */ { memblk new; - dfilled=mailread=0;makeblock(&new,0);readdyn(&new,&dfilled,0); + dfilled=mailread=0;makeblock(&new,0); + readdyn(&new,&dfilled,thebody-themail.p); if(tobesent>dfilled&&isprivate) /* put it in place here */ { tmemmove(themail.p+dfilled,thebody,filled-=tobesent); tmemmove(themail.p,new.p,dfilled); --- procmail-3.22.orig/src/manconf.c +++ procmail-3.22/src/manconf.c @@ -233,7 +233,7 @@ \2-@PRESERVOPT@\1and\1.BR \2-@FROMWHOPT@ .\1"); pc("LMTPOPT",LMTPOPT); #else - ps("LMTPOPTdesc","");ps("LMTPusage",""); + ps("LMTPOPTdesc","");ps("LMTPusage","\1"); #endif pname("INIT_UMASK",0);printf("0%lo/g\n",(unsigned long)INIT_UMASK);lines--; pn("DEFlinebuf",DEFlinebuf); --- procmail-3.22.orig/src/memblk.c +++ procmail-3.22/src/memblk.c @@ -51,11 +51,11 @@ { #ifdef USE_MMAP if(mb->fd>=0) - { long len=mb->len+1; - if(munmap(mb->p,len)) - mmapfailed(len); /* don't want to continue here */ - if((mb->p=mmap(0,len,PROT_READ,MAP_PRIVATE,mb->fd,(off_t)0))==MAP_FAILED) - mmapfailed(len); + { long mlen=mb->len+1; + if(munmap(mb->p,mlen)) + mmapfailed(mlen); /* don't want to continue here */ + if((mb->p=mmap(0,mlen,PROT_READ,MAP_PRIVATE,mb->fd,(off_t)0))==MAP_FAILED) + mmapfailed(mlen); close(mb->fd); mb->fd=ropen(devnull,O_RDWR,0); /* XXX Perhaps -1 is better? */ } @@ -77,8 +77,8 @@ strcpy(filename,MMAP_DIR); if(unique(filename,strchr(filename,'\0'),MMAP_FILE_LEN,MMAP_PERM,0,0)&& (mb->fd=ropen(filename,O_RDWR,MMAP_PERM),unlink(filename),mb->fd>=0)) - { mb->filelen=len; - if(lseek(mb->fd,mb->filelen-1,SEEK_SET)<0||1!=rwrite(mb->fd,empty,1)) + { mb->filelen=len+1; + if(lseek(mb->fd,len,SEEK_SET)<0||1!=rwrite(mb->fd,empty,1)) dropf: { close(mb->fd);mb->fd= -1; if(verbose)nlog("Unable to extend or use tempfile"); } @@ -98,9 +98,9 @@ } } if(mb->fd>=0) - { if(len>mb->filelen) /* need to extend? */ - { mb->filelen=len; - if(lseek(mb->fd,mb->filelen-1,SEEK_SET)<0||1!=rwrite(mb->fd,empty,1)) + { if(len>=mb->filelen) /* need to extend? */ + { mb->filelen=len+1; + if(lseek(mb->fd,len,SEEK_SET)<0||1!=rwrite(mb->fd,empty,1)) { char*p=malloc(len+1); /* can't extend, switch to malloc */ tmemmove(p,mb->p,mb->len); munmap(mb->p,mb->len+1); @@ -124,9 +124,9 @@ } else mb->p=realloc(mb->p,len+1); - mb->len=len+1; - mb->p[len]='\0'; + mb->len=len; ret1: + mb->p[len]='\0'; return 1; } --- procmail-3.22.orig/src/memblk.h +++ procmail-3.22/src/memblk.h @@ -1,6 +1,6 @@ typedef struct memblk { char*p; /* where it starts */ - long len; /* currently allocated size */ + long len; /* current size, not including trailing NUL */ #ifdef USE_MMAP off_t filelen; /* how long is the file */ int fd; /* file which is mmap()ed */ --- procmail-3.22.orig/src/pipes.c +++ procmail-3.22/src/pipes.c @@ -145,7 +145,9 @@ if(Stdout) { *(eq=strchr(Stdout,'\0')-1)='\0'; /* chop the '=' */ if(!(backblock=getenv(Stdout))) /* no current value? */ - PRDB=PWRB= -1; + { PRDB=PWRB= -1; + backlen=0; + } else { backlen=strlen(backblock); goto pip; @@ -155,9 +157,7 @@ pip: rpipe(pbackfd); rpipe(pinfd); /* main pipes setup */ if(!(pidchild=sfork())) /* create a sending procmail */ - { if(Stdout&&backblock) - backlen=strlen(backblock); - else + { if(!Stdout) backblock=source,backlen=len; childsetup();rclose(PRDI);rclose(PRDB); rpipe(poutfd);rclose(STDOUT); @@ -194,7 +194,7 @@ makeblock(&temp,Stdfilled); tmemmove(temp.p,Stdout,Stdfilled); readdyn(&temp,&Stdfilled,Stdfilled+backlen+1); - Stdout=realloc(Stdout,&Stdfilled+1); + Stdout=realloc(Stdout,Stdfilled+1); tmemmove(Stdout,temp.p,Stdfilled+1); freeblock(&temp); retStdout(Stdout,pwait&&pipw,!backblock); --- procmail-3.22.orig/src/procmail.c +++ procmail-3.22/src/procmail.c @@ -652,8 +652,7 @@ nrcond= -1; if(tolock) /* clear temporary buffer for lockfile name */ free(tolock); - for(i=maxindex(flags);i;i--) /* clear the flags */ - flags[i]=0; + bbzero(flags,sizeof(flags)); /* clear the flags */ for(tolock=0,locknext=0;;) { chp=skpspace(chp); switch(i= *chp++)