[libsoup] soup-http-input-stream: fixed a condition



commit c5ece4947054deadfbc5aad247d33375df56ed0e
Author: Sergio Villar Senin <svillar igalia com>
Date:   Mon Dec 13 10:31:22 2010 +0100

    soup-http-input-stream: fixed a condition
    
    priv->caller_buffsize and priv->leftover_bufsize are both unsigned integers,
    and thus, checking (a - b > 0) could incorrectly return TRUE if b > a.

 libsoup/soup-http-input-stream.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/libsoup/soup-http-input-stream.c b/libsoup/soup-http-input-stream.c
index cee978f..2687133 100644
--- a/libsoup/soup-http-input-stream.c
+++ b/libsoup/soup-http-input-stream.c
@@ -266,7 +266,7 @@ soup_http_input_stream_got_chunk (SoupMessage *msg, SoupBuffer *chunk_buffer,
 		g_warning ("soup_http_input_stream_got_chunk called again before previous chunk was processed");
 
 	/* Copy what we can into priv->caller_buffer */
-	if (priv->caller_bufsize - priv->caller_nread > 0) {
+	if (priv->caller_bufsize > priv->caller_nread) {
 		gsize nread = MIN (chunk_size, priv->caller_bufsize - priv->caller_nread);
 
 		memcpy (priv->caller_buffer + priv->caller_nread, chunk, nread);



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