]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] LibUCL: Fix reading at the end of chunk
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 30 May 2019 16:23:44 +0000 (17:23 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 30 May 2019 16:23:44 +0000 (17:23 +0100)
contrib/libucl/ucl_parser.c

index 7313b28a3753bcb407f382b9b97b9f941992edbe..b048f426a38aa43433f9a783ce64ed273d9bbc19 100644 (file)
@@ -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;
+                                               }
                                        }
                                }