Fixed some more conditional jumps that depended on uninitialized values

This commit is contained in:
Jaroslav Škarvada 2017-03-22 17:23:48 +01:00
parent 4236e6a6fb
commit 1dd8aba0da
2 changed files with 24 additions and 11 deletions

View File

@ -1,9 +1,8 @@
From: Tero Marttila <terom@fixme.fi> diff --git a/src/cstdio.c b/src/cstdio.c
Subject: Fix off-by-one error that makes procmail to segfault on certain .procmailrc files index 7b6fe6d..0a0bd5b 100644
--- a/src/cstdio.c --- a/src/cstdio.c
+++ b/src/cstdio.c +++ b/src/cstdio.c
@@ -144,7 +144,7 @@ @@ -144,7 +144,7 @@ int getbl(p,end)char*p,*end; /* my gets */
{ case '\n':case EOF:*q='\0'; { case '\n':case EOF:*q='\0';
return overflow?-1:p!=q; /* did we read anything at all? */ return overflow?-1:p!=q; /* did we read anything at all? */
} }
@ -12,7 +11,7 @@ Subject: Fix off-by-one error that makes procmail to segfault on certain .procma
q=p,overflow=1; q=p,overflow=1;
*q++=i; *q++=i;
} }
@@ -199,7 +199,7 @@ @@ -199,7 +199,7 @@ int getlline(target,end)char*target,*end;
if(*(target=strchr(target,'\0')-1)=='\\') if(*(target=strchr(target,'\0')-1)=='\\')
{ if(chp2!=target) /* non-empty line? */ { if(chp2!=target) /* non-empty line? */
target++; /* then preserve the backslash */ target++; /* then preserve the backslash */
@ -21,23 +20,34 @@ Subject: Fix off-by-one error that makes procmail to segfault on certain .procma
target=end-linebuf,overflow=1; /* toss what we have */ target=end-linebuf,overflow=1; /* toss what we have */
continue; continue;
} }
From: Jan Darmochwal <jdarmochwal@gmx.de> diff --git a/src/formail.c b/src/formail.c
Subject: formail memory corruption fixes index 1f5c9dd..49b9967 100644
--- a/src/formail.c --- a/src/formail.c
+++ b/src/formail.c +++ b/src/formail.c
@@ -219,7 +219,7 @@ @@ -219,7 +219,8 @@ static char*getsender(namep,fldp,headreply)char*namep;struct field*fldp;
if(i>=0&&(i!=maxindex(sest)||fldp==rdheader)) /* found anything? */ if(i>=0&&(i!=maxindex(sest)||fldp==rdheader)) /* found anything? */
{ char*saddr;char*tmp; /* determine the weight */ { char*saddr;char*tmp; /* determine the weight */
nowm=areply&&headreply?headreply==1?sest[i].wrepl:sest[i].wrrepl:i;chp+=j; nowm=areply&&headreply?headreply==1?sest[i].wrepl:sest[i].wrrepl:i;chp+=j;
- tmp=malloc(j=fldp->Tot_len-j);tmemmove(tmp,chp,j);(chp=tmp)[j-1]='\0'; - tmp=malloc(j=fldp->Tot_len-j);tmemmove(tmp,chp,j);(chp=tmp)[j-1]='\0';
+ tmp=malloc((j=fldp->Tot_len-j) + 1);tmemmove(tmp,chp,j);(chp=tmp)[j-1]='\0'; + tmp=malloc((j=fldp->Tot_len-j) + 1);tmemmove(tmp,chp,j);(chp=tmp)[j-1]='\0';
+ chp[j]='\0';
if(sest[i].head==From_) if(sest[i].head==From_)
{ char*pastad; { char*pastad;
if(strchr(saddr=chp,'\n')) /* multiple From_ lines */ if(strchr(saddr=chp,'\n')) /* multiple From_ lines */
@@ -364,7 +365,7 @@ static PROGID;
int main(lastm,argv)int lastm;const char*const argv[];
{ int i,split=0,force=0,bogus=1,every=0,headreply=0,digest=0,nowait=0,keepb=0,
- minfields=(char*)progid-(char*)progid,conctenate=0,babyl=0,babylstart,
+ minfields=(char*)progid-(char*)progid,conctenate=0,babyl=0,babylstart=0,
berkeley=0,forgetclen;
long maxlen,ctlength;FILE*idcache=0;pid_t thepid;
size_t j,lnl,escaplen;char*chp,*namep,*escap=ESCAP;
diff --git a/src/formisc.c b/src/formisc.c
index c48df52..5c2869d 100644
--- a/src/formisc.c --- a/src/formisc.c
+++ b/src/formisc.c +++ b/src/formisc.c
@@ -66,7 +66,7 @@ @@ -66,7 +66,7 @@ inc: start++;
retz: *target='\0'; retz: *target='\0';
ret: return start; ret: return start;
} }

View File

@ -8,7 +8,7 @@
Summary: Mail processing program Summary: Mail processing program
Name: procmail Name: procmail
Version: 3.22 Version: 3.22
Release: 40%{?dist} Release: 41%{?dist}
License: GPLv2+ or Artistic License: GPLv2+ or Artistic
Group: Applications/Internet Group: Applications/Internet
# Source: ftp://ftp.procmail.org/pub/procmail/procmail-%{version}.tar.gz # Source: ftp://ftp.procmail.org/pub/procmail/procmail-%{version}.tar.gz
@ -81,6 +81,9 @@ rm -rf ${RPM_BUILD_ROOT}
%{_mandir}/man[15]/* %{_mandir}/man[15]/*
%changelog %changelog
* Wed Mar 22 2017 Jaroslav Škarvada <jskarvad@redhat.com> - 3.22-41
- Fixed some more conditional jumps that depended on uninitialized values
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.22-40 * Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.22-40
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild