[PATCH 38/41] udp.c: call buffer_init

Ian Jackson ijackson at chiark.greenend.org.uk
Thu Jul 25 18:41:04 BST 2013


Nothing in udp.c call buffer_init.  This might result in start padding
underflows (assertion failures) if packets come in via routes that
don't strip (much) off the front and then go out via routes that do
add lots at the front.

Signed-off-by: Ian Jackson <ijackson at chiark.greenend.org.uk>
---
 udp.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/udp.c b/udp.c
index 42fbb1f..1e637b6 100644
--- a/udp.c
+++ b/udp.c
@@ -102,6 +102,7 @@ static void udp_afterpoll(void *state, struct pollfd *fds, int nfds)
 	    fromlen=sizeof(from);
 	    BUF_ASSERT_FREE(st->rbuf);
 	    BUF_ALLOC(st->rbuf,"udp_afterpoll");
+	    buffer_init(st->rbuf,calculate_max_start_pad());
 	    rv=recvfrom(st->fd, st->rbuf->start, st->rbuf->len, 0,
 			(struct sockaddr *)&from, &fromlen);
 	    if (rv>0) {
-- 
1.7.2.5




More information about the sgo-software-discuss mailing list