[rygel] core: Don't use buffer larger than size of data



commit 585b21f721f164d45a634374f658ee32445153ae
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Mar 30 18:23:11 2011 +0300

    core: Don't use buffer larger than size of data

 src/rygel/rygel-http-seekable-response.vala |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/src/rygel/rygel-http-seekable-response.vala b/src/rygel/rygel-http-seekable-response.vala
index 0f65e07..da16660 100644
--- a/src/rygel/rygel-http-seekable-response.vala
+++ b/src/rygel/rygel-http-seekable-response.vala
@@ -67,7 +67,12 @@ internal class Rygel.HTTPSeekableResponse : Rygel.HTTPResponse {
         this.seek = request.seek;
         this.total_length = (size_t) this.seek.length;
 
-        this.buffer = new uint8[HTTPSeekableResponse.BUFFER_LENGTH];
+        if (this.total_length > BUFFER_LENGTH) {
+            this.buffer = new uint8[HTTPSeekableResponse.BUFFER_LENGTH];
+        } else {
+            this.buffer = new uint8[this.total_length];
+        }
+
         this.file = File.new_for_uri (uri);
     }
 



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