commit ff83de0: [Minor] LibUCL: Fix reading at the end of chunk

Vsevolod Stakhov vsevolod at highsecure.ru
Thu May 30 16:28:06 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-05-30 17:23:44 +0100
URL: https://github.com/rspamd/rspamd/commit/ff83de0104b73b4ac8350ad056c6c853cfd0cff4 (HEAD -> master)

[Minor] LibUCL: Fix reading at the end of chunk

---
 contrib/libucl/ucl_parser.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/contrib/libucl/ucl_parser.c b/contrib/libucl/ucl_parser.c
index 7313b28a3..b048f426a 100644
--- a/contrib/libucl/ucl_parser.c
+++ b/contrib/libucl/ucl_parser.c
@@ -2366,20 +2366,22 @@ ucl_state_machine (struct ucl_parser *parser)
 
 				p = chunk->pos;
 
-				if (*p == '[') {
-					parser->state = UCL_STATE_VALUE;
-					ucl_chunk_skipc (chunk, p);
-					seen_obrace = true;
-				}
-				else {
-
-					if (*p == '{') {
+				if (p < chunk->end) {
+					if (*p == '[') {
+						parser->state = UCL_STATE_VALUE;
 						ucl_chunk_skipc (chunk, p);
-						parser->state = UCL_STATE_KEY_OBRACE;
 						seen_obrace = true;
 					}
 					else {
-						parser->state = UCL_STATE_KEY;
+
+						if (*p == '{') {
+							ucl_chunk_skipc (chunk, p);
+							parser->state = UCL_STATE_KEY_OBRACE;
+							seen_obrace = true;
+						}
+						else {
+							parser->state = UCL_STATE_KEY;
+						}
 					}
 				}
 


More information about the Commits mailing list