[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/8] mbuffers: fix wrong size calculation.
From: |
Jonathan Bastien-Filiatrault |
Subject: |
[PATCH 3/8] mbuffers: fix wrong size calculation. |
Date: |
Wed, 8 Sep 2010 18:34:42 -0400 |
maximum_size is the maximum size of the payload, not including
overhead.
Signed-off-by: Jonathan Bastien-Filiatrault <address@hidden>
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
- [PATCH] Read-side mbuffers, Jonathan Bastien-Filiatrault, 2010/09/08
- [PATCH 1/8] mbuffers: Document the internal mbuffer API., Jonathan Bastien-Filiatrault, 2010/09/08
- [PATCH 2/8] mbuffers: Make _mbuffer_remove_bytes return a meaningful error code., Jonathan Bastien-Filiatrault, 2010/09/08
- [PATCH 3/8] mbuffers: fix wrong size calculation.,
Jonathan Bastien-Filiatrault <=
- [PATCH 5/8] Parenthesize size calculations., Jonathan Bastien-Filiatrault, 2010/09/08
- [PATCH 4/8] mbuffers: Add mbuffer_linearize., Jonathan Bastien-Filiatrault, 2010/09/08
- [PATCH 6/8] mbuffers: make _gnutls_io_read_buffered use mbuffers., Jonathan Bastien-Filiatrault, 2010/09/08
- [PATCH 8/8] Fully mbufferize _gnutls_read and _gnutls_read_buffered., Jonathan Bastien-Filiatrault, 2010/09/08
- [PATCH 7/8] mbuffers: Add _mbuffer_xfree operation., Jonathan Bastien-Filiatrault, 2010/09/08
- Re: [PATCH] Read-side mbuffers, Nikos Mavrogiannopoulos, 2010/09/09