[PATCH 3/8] mbuffers: fix wrong size calculation.
Jonathan Bastien-Filiatrault
joe at x2a.org
Thu Sep 9 00:34:42 CEST 2010
maximum_size is the maximum size of the payload, not including
overhead.
Signed-off-by: Jonathan Bastien-Filiatrault <joe at x2a.org>
diff --git a/lib/gnutls_mbuffers.c b/lib/gnutls_mbuffers.c
index 7ebcc40..45c4b97 100644
--- a/lib/gnutls_mbuffers.c
+++ b/lib/gnutls_mbuffers.c
@@ -259,7 +259,7 @@ _mbuffer_alloc (size_t payload_size, size_t maximum_size)
int
_mbuffer_append_data (mbuffer_st *bufel, void* newdata, size_t newdata_size)
{
- if (sizeof(mbuffer_st)+bufel->msg.size+newdata_size < bufel->maximum_size)
+ if (bufel->msg.size+newdata_size <= bufel->maximum_size)
{
memcpy(&bufel->msg.data[bufel->msg.size], newdata, newdata_size);
bufel->msg.size+=newdata_size;
--
1.7.1
More information about the Gnutls-devel
mailing list