[ncompress] use memmove instead of memcpy to prevent memory overlap corruption(#760657)

Ondrej Vasik ovasik at fedoraproject.org
Tue Jan 3 14:19:12 UTC 2012


commit 0582647d6bc86c8fd4af57880f72e11a3054e155
Author: Ondřej Vašík <ovasik at redhat.com>
Date:   Tue Jan 3 15:19:01 2012 +0100

    use memmove instead of memcpy to prevent memory overlap corruption(#760657)

 ncompress-4.2.4-memmove.patch |   12 ++++++++++++
 ncompress.spec                |    8 +++++++-
 2 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/ncompress-4.2.4-memmove.patch b/ncompress-4.2.4-memmove.patch
new file mode 100644
index 0000000..d8fec3e
--- /dev/null
+++ b/ncompress-4.2.4-memmove.patch
@@ -0,0 +1,12 @@
+diff -urNp ncompress-4.2.4-orig/compress42.c ncompress-4.2.4/compress42.c
+--- ncompress-4.2.4-orig/compress42.c	2012-01-03 15:13:58.014222927 +0100
++++ ncompress-4.2.4/compress42.c	2012-01-03 15:15:17.117097419 +0100
+@@ -1441,7 +1441,7 @@ compress(fdin, fdout)
+ 					boff = -(((OBUFSIZ<<3)-boff)%(n_bits<<3));
+ 					bytes_out += OBUFSIZ;
+ 
+-					memcpy(outbuf, outbuf+OBUFSIZ, (outbits>>3)+1);
++					memmove(outbuf, outbuf+OBUFSIZ, (outbits>>3)+1);
+ 					memset(outbuf+(outbits>>3)+1, '\0', OBUFSIZ);
+ 				}
+ 
diff --git a/ncompress.spec b/ncompress.spec
index d9622ed..e912c7a 100644
--- a/ncompress.spec
+++ b/ncompress.spec
@@ -1,7 +1,7 @@
 Summary: Fast compression and decompression utilities
 Name: ncompress
 Version: 4.2.4
-Release: 55%{?dist}
+Release: 56%{?dist}
 License: Public Domain
 Group: Applications/File
 URL:    http://ncompress.sourceforge.net/
@@ -14,6 +14,7 @@ Patch4: ncompress-4.2.4-zerobyteforce.patch
 Patch5: ncompress-4.2.4-bssUnderflow.patch
 Patch6: ncompress-4.2.4-endians.patch
 Patch7: ncompress-4.2.4-uncheckedmalloc.patch
+Patch8: ncompress-4.2.4-memmove.patch
 BuildRequires: gcc glibc-devel fileutils
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
@@ -37,6 +38,7 @@ which are compatible with the original UNIX compress utility.
 %patch5 -p1 -b .bssUnderflow
 %patch6 -p1 -b .endians
 %patch7 -p1 -b .malloccheck
+%patch8 -p1 -b .memmove
 mv Makefile.def Makefile
 
 %build
@@ -74,6 +76,10 @@ rm -rf $RPM_BUILD_ROOT
 %doc LZW.INFO README
 
 %changelog
+* Tue Jan 03 2012 Ondrej Vasik <ovasik at redhat.com> - 4.2.4-56
+- use memmove instead of memcpy to prevent memory overlap corruption
+ (#760657)
+
 * Tue Feb 08 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 4.2.4-55
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
 


More information about the scm-commits mailing list