chiark / gitweb /
udp.c: call buffer_init
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 25 Jul 2013 17:30:53 +0000 (18:30 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 25 Jul 2013 17:30:53 +0000 (18:30 +0100)
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@chiark.greenend.org.uk>
udp.c

diff --git a/udp.c b/udp.c
index 42fbb1f..1e637b6 100644 (file)
--- 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) {