From 290208c19ed5dc799460b8fc6c0913bc563fc8a0 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Fri, 24 Aug 2018 16:08:29 +0800 Subject: [PATCH] lejp: always allow an extra byte at the end of the string buffer for NUL --- lib/libwebsockets.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libwebsockets.h b/lib/libwebsockets.h index 3b689b056..fab3ff782 100644 --- a/lib/libwebsockets.h +++ b/lib/libwebsockets.h @@ -7209,7 +7209,7 @@ typedef signed char (*lejp_callback)(struct lejp_ctx *ctx, char reason); #endif #ifndef LEJP_STRING_CHUNK /* must be >= 30 to assemble floats */ -#define LEJP_STRING_CHUNK 255 +#define LEJP_STRING_CHUNK 254 #endif enum num_flags { @@ -7243,7 +7243,7 @@ struct lejp_ctx { uint16_t i[LEJP_MAX_INDEX_DEPTH]; /* index array */ uint16_t wild[LEJP_MAX_INDEX_DEPTH]; /* index array */ char path[LEJP_MAX_PATH]; - char buf[LEJP_STRING_CHUNK]; + char buf[LEJP_STRING_CHUNK + 1]; /* int */