Hi,

On Tue, Mar 12, 2013 at 09:32:36AM +0100, Steffan Karger wrote:
> Shouldn't the return type be size_t or at least unsigned int, as mbuf->len is 
> also of type unsigned int?

Well, unsigned int, as ->len is not a size_t.  

Not that it makes any real difference as we're talking about a range 
between "0" and "65" here.  But anyway.  Patch v2 is below.

gert
-- 
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             g...@greenie.muc.de
fax: +49-89-35655025                        g...@net.informatik.tu-muenchen.de
From b6add3999621825420f7e56e4c7790dc30a68ffe Mon Sep 17 00:00:00 2001
From: Gert Doering <g...@greenie.muc.de>
List-Post: openvpn-devel@lists.sourceforge.net
Date: Mon, 11 Mar 2013 21:03:20 +0100
Subject: [PATCH v2] Repair "tcp server queue overflow" brokenness, more
 <stdbool.h> fallout.

Return value of mbuf_len() wrong - it's returning a length value, not
a yes/no value - so when the queue length approached 65 (full!), it
still only returned "1", leading to MBUF overflow later on.  Change
from "bool" to "unsigned int", misbehaviour gone...

Signed-off-by: Gert Doering <g...@greenie.muc.de>
---
 src/openvpn/mbuf.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/openvpn/mbuf.h b/src/openvpn/mbuf.h
index a0de679..1085adc 100644
--- a/src/openvpn/mbuf.h
+++ b/src/openvpn/mbuf.h
@@ -83,7 +83,7 @@ mbuf_defined (const struct mbuf_set *ms)
   return ms && ms->len;
 }
 
-static inline bool
+static inline unsigned int
 mbuf_len (const struct mbuf_set *ms)
 {
   return ms->len;
-- 
1.7.8.6

Attachment: pgpFLip7gYB4s.pgp
Description: PGP signature

Reply via email to