Fixed possible buffer overflow in loadbuf function

Resolves: rhbz#1500071
This commit is contained in:
Jaroslav Škarvada 2017-10-10 23:56:59 +02:00
parent 277e2d7c62
commit 43b93032c2
2 changed files with 20 additions and 1 deletions

View File

@ -0,0 +1,13 @@
diff --git a/src/formisc.c b/src/formisc.c
index 5c2869d..54fd013 100644
--- a/src/formisc.c
+++ b/src/formisc.c
@@ -103,7 +103,7 @@ void loadsaved(sp)const struct saved*const sp; /* load some saved text */
}
/* append to buf */
void loadbuf(text,len)const char*const text;const size_t len;
-{ if(buffilled+len>buflen) /* buf can't hold the text */
+{ while(buffilled+len>buflen) /* buf can't hold the text */
buf=realloc(buf,buflen+=Bsize);
tmemmove(buf+buffilled,text,len);buffilled+=len;
}

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: 43%{?dist} Release: 44%{?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
@ -26,6 +26,7 @@ Patch5: procmail-3.22-ipv6.patch
Patch6: procmail-3.22-getline.patch Patch6: procmail-3.22-getline.patch
Patch7: procmail-3.22-CVE-2014-3618.patch Patch7: procmail-3.22-CVE-2014-3618.patch
Patch8: procmail-3.22-crash-fix.patch Patch8: procmail-3.22-crash-fix.patch
Patch9: procmail-3.22-loadbuf-fix.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%description %description
@ -46,6 +47,7 @@ forward certain incoming mail automatically to someone.
%patch6 -p1 -b .getline %patch6 -p1 -b .getline
%patch7 -p1 -b .CVE-2014-3618 %patch7 -p1 -b .CVE-2014-3618
%patch8 -p1 -b .crash-fix %patch8 -p1 -b .crash-fix
%patch9 -p1 -b .loadbuf-fix
find examples -type f | xargs chmod 644 find examples -type f | xargs chmod 644
@ -81,6 +83,10 @@ rm -rf ${RPM_BUILD_ROOT}
%{_mandir}/man[15]/* %{_mandir}/man[15]/*
%changelog %changelog
* Tue Oct 10 2017 Jaroslav Škarvada <jskarvad@redhat.com> - 3.22-44
- Fixed possible buffer overflow in loadbuf function
Resolves: rhbz#1500071
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.22-43 * Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.22-43
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild