]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Backport some fixes from libucl
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 14 Mar 2021 19:03:40 +0000 (19:03 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 14 Mar 2021 19:03:40 +0000 (19:03 +0000)
contrib/libucl/ucl_chartable.h
contrib/libucl/ucl_schema.c

index 043b62689921409e5fa69a85d27b5aa8653b1911..7571a1d91549211d13e0ddcc7cb09bea75b05713 100644 (file)
@@ -49,7 +49,7 @@ UCL_CHARACTER_VALUE_END /* # */, UCL_CHARACTER_VALUE_STR /* $ */,
 UCL_CHARACTER_VALUE_STR /* % */, UCL_CHARACTER_VALUE_STR /* & */,
 UCL_CHARACTER_VALUE_STR /* ' */, UCL_CHARACTER_VALUE_STR /* ( */,
 UCL_CHARACTER_VALUE_STR /* ) */, UCL_CHARACTER_VALUE_STR /* * */,
-UCL_CHARACTER_VALUE_STR|UCL_CHARACTER_VALUE_DIGIT /* + */,
+UCL_CHARACTER_VALUE_STR|UCL_CHARACTER_VALUE_DIGIT|UCL_CHARACTER_UCL_UNSAFE /* + */,
 UCL_CHARACTER_VALUE_END /* , */,
 UCL_CHARACTER_KEY|UCL_CHARACTER_VALUE_STR|UCL_CHARACTER_VALUE_DIGIT_START|UCL_CHARACTER_VALUE_DIGIT /* - */,
 UCL_CHARACTER_KEY|UCL_CHARACTER_VALUE_STR|UCL_CHARACTER_VALUE_DIGIT /* . */,
index d11d6690975219d06fa4740252165d813e8a66c7..68f01187e375743f965f36eac8472d2c94f56e41 100644 (file)
@@ -244,20 +244,22 @@ ucl_schema_validate_object (const ucl_object_t *schema,
                /* Additional properties */
                if (!allow_additional || additional_schema != NULL) {
                        /* Check if we have exactly the same properties in schema and object */
-                       iter = NULL;
+                       iter = ucl_object_iterate_new (obj);
                        prop = ucl_object_lookup (schema, "properties");
-                       while ((elt = ucl_object_iterate (obj, &iter, true)) != NULL) {
+                       while ((elt = ucl_object_iterate_safe (iter, true)) != NULL) {
                                found = ucl_object_lookup (prop, ucl_object_key (elt));
                                if (found == NULL) {
                                        /* Try patternProperties */
-                                       piter = NULL;
                                        pat = ucl_object_lookup (schema, "patternProperties");
-                                       while ((pelt = ucl_object_iterate (pat, &piter, true)) != NULL) {
+                                       piter = ucl_object_iterate_new (pat);
+                                       while ((pelt = ucl_object_iterate_safe (piter, true)) != NULL) {
                                                found = ucl_schema_test_pattern (obj, ucl_object_key (pelt), true);
                                                if (found != NULL) {
                                                        break;
                                                }
                                        }
+                                       ucl_object_iterate_free (piter);
+                                       piter = NULL;
                                }
                                if (found == NULL) {
                                        if (!allow_additional) {
@@ -276,6 +278,8 @@ ucl_schema_validate_object (const ucl_object_t *schema,
                                        }
                                }
                        }
+                       ucl_object_iterate_free (iter);
+                       iter = NULL;
                }
                /* Required properties */
                if (required != NULL) {