File libsndfile-fix-header-read-CVE-2015-7805.patch of Package libsndfile.4961

---
 src/common.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/src/common.c
+++ b/src/common.c
@@ -800,9 +800,10 @@ header_read (SF_PRIVATE *psf, void *ptr,
 	if (psf->headindex + bytes > SIGNED_SIZEOF (psf->header))
 	{	int most ;
 
-		most = SIGNED_SIZEOF (psf->header) - psf->headindex ;
+		most = SIGNED_SIZEOF (psf->header) - psf->headend ;
 		psf_fread (psf->header + psf->headend, 1, most, psf) ;
-		memcpy (ptr, psf->header + psf->headend, most) ;
+		most = SIGNED_SIZEOF (psf->header) - psf->headindex ;
+		memcpy (ptr, psf->header + psf->headindex, most) ;
 		psf->headend = psf->headindex += most ;
 		psf_fread ((char *) ptr + most, bytes - most, 1, psf) ;
 		return bytes ;
openSUSE Build Service is sponsored by