summaryrefslogtreecommitdiff
path: root/zebra/zserv.c
diff options
context:
space:
mode:
authorMark Stapp <mjs@voltanet.io>2019-05-31 16:20:38 -0400
committerGitHub <noreply@github.com>2019-05-31 16:20:38 -0400
commit32e4ce5fd522000e285dcda2da1038a4f49d731c (patch)
treeaca3c69450935a0528bb6618f6322a35292b452e /zebra/zserv.c
parentce231fbc872650f5ecd2415b99df259fa2f81377 (diff)
parentf3f45626125b117b4dc25498fced056da41bb493 (diff)
Merge pull request #4435 from donaldsharp/zclient_buffer_sizing
lib, zebra: Ensure route encoding has enough space
Diffstat (limited to 'zebra/zserv.c')
-rw-r--r--zebra/zserv.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/zebra/zserv.c b/zebra/zserv.c
index fbb5af875d..49fb302ba8 100644
--- a/zebra/zserv.c
+++ b/zebra/zserv.c
@@ -682,6 +682,8 @@ static int zserv_handle_client_fail(struct thread *thread)
static struct zserv *zserv_client_create(int sock)
{
struct zserv *client;
+ size_t stream_size =
+ MAX(ZEBRA_MAX_PACKET_SIZ, sizeof(struct zapi_route));
int i;
afi_t afi;
@@ -691,8 +693,8 @@ static struct zserv *zserv_client_create(int sock)
client->sock = sock;
client->ibuf_fifo = stream_fifo_new();
client->obuf_fifo = stream_fifo_new();
- client->ibuf_work = stream_new(ZEBRA_MAX_PACKET_SIZ);
- client->obuf_work = stream_new(ZEBRA_MAX_PACKET_SIZ);
+ client->ibuf_work = stream_new(stream_size);
+ client->obuf_work = stream_new(stream_size);
pthread_mutex_init(&client->ibuf_mtx, NULL);
pthread_mutex_init(&client->obuf_mtx, NULL);
client->wb = buffer_new(0);