summaryrefslogtreecommitdiff
path: root/lib
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 /lib
parentce231fbc872650f5ecd2415b99df259fa2f81377 (diff)
parentf3f45626125b117b4dc25498fced056da41bb493 (diff)
Merge pull request #4435 from donaldsharp/zclient_buffer_sizing
lib, zebra: Ensure route encoding has enough space
Diffstat (limited to 'lib')
-rw-r--r--lib/zclient.c7
-rw-r--r--lib/zclient.h2
2 files changed, 6 insertions, 3 deletions
diff --git a/lib/zclient.c b/lib/zclient.c
index 0972590ca6..e9b4f5a58b 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -62,10 +62,13 @@ struct zclient *zclient_new(struct thread_master *master,
struct zclient_options *opt)
{
struct zclient *zclient;
+ size_t stream_size =
+ MAX(ZEBRA_MAX_PACKET_SIZ, sizeof(struct zapi_route));
+
zclient = XCALLOC(MTYPE_ZCLIENT, sizeof(struct zclient));
- zclient->ibuf = stream_new(ZEBRA_MAX_PACKET_SIZ);
- zclient->obuf = stream_new(ZEBRA_MAX_PACKET_SIZ);
+ zclient->ibuf = stream_new(stream_size);
+ zclient->obuf = stream_new(stream_size);
zclient->wb = buffer_new(0);
zclient->master = master;
diff --git a/lib/zclient.h b/lib/zclient.h
index 09f0acad84..c61c8d4226 100644
--- a/lib/zclient.h
+++ b/lib/zclient.h
@@ -39,7 +39,7 @@
#include "mlag.h"
/* For input/output buffer to zebra. */
-#define ZEBRA_MAX_PACKET_SIZ 16384
+#define ZEBRA_MAX_PACKET_SIZ 16384U
/* Zebra header size. */
#define ZEBRA_HEADER_SIZE 10