[gmime] Prevent buffer underruns in gmime-stream-filter.c



commit 8ec940c09c8cf8abbc9cd03d0d98199680897ed9
Author: Jeffrey Stedfast <fejj gnome org>
Date:   Sat Oct 27 15:48:07 2012 -0400

    Prevent buffer underruns in gmime-stream-filter.c
    
    2012-10-27  Jeffrey Stedfast  <fejj gnome org>
    
    	* gmime/gmime-stream-filter.c (stream_read): Initialize presize to
    	READ_PAD instead of READ_SIZE to prevent potential buffer
    	underruns.

 ChangeLog                   |    6 ++++++
 gmime/gmime-stream-filter.c |    2 +-
 2 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 88023d9..9624c0f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-10-27  Jeffrey Stedfast  <fejj gnome org>
+
+	* gmime/gmime-stream-filter.c (stream_read): Initialize presize to
+	READ_PAD instead of READ_SIZE to prevent potential buffer
+	underruns.
+
 2012-10-20  Jeffrey Stedfast  <fejj gnome org>
 
 	* gmime/gmime-filter-gzip.c (gunzip_filter): Apparently
diff --git a/gmime/gmime-stream-filter.c b/gmime/gmime-stream-filter.c
index dd36749..f050ec1 100644
--- a/gmime/gmime-stream-filter.c
+++ b/gmime/gmime-stream-filter.c
@@ -185,7 +185,7 @@ stream_read (GMimeStream *stream, char *buf, size_t n)
 	priv->last_was_read = TRUE;
 	
 	if (priv->filteredlen <= 0) {
-		size_t presize = READ_SIZE;
+		size_t presize = READ_PAD;
 		
 		nread = g_mime_stream_read (filter->source, priv->buffer, READ_SIZE);
 		if (nread <= 0) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]