]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Fix processing of '\v' in libucl
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 29 Mar 2018 12:57:41 +0000 (13:57 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 29 Mar 2018 12:57:41 +0000 (13:57 +0100)
Issue: #2045

contrib/libucl/ucl_emitter_utils.c

index 04940a9028aee1fb0ebe436ff431d945ad489a41..11a6c4b3d7e63f84b2ed6c6096cdf73afe13268c 100644 (file)
@@ -102,7 +102,9 @@ ucl_elt_string_write_json (const char *str, size_t size,
        func->ucl_emitter_append_character ('"', 1, func->ud);
 
        while (size) {
-               if (ucl_test_character (*p, UCL_CHARACTER_JSON_UNSAFE|UCL_CHARACTER_DENIED)) {
+               if (ucl_test_character (*p, (UCL_CHARACTER_JSON_UNSAFE|
+                               UCL_CHARACTER_DENIED|
+                               UCL_CHARACTER_WHITESPACE_UNSAFE))) {
                        if (len > 0) {
                                func->ucl_emitter_append_len (c, len, func->ud);
                        }
@@ -122,9 +124,15 @@ ucl_elt_string_write_json (const char *str, size_t size,
                        case '\f':
                                func->ucl_emitter_append_len ("\\f", 2, func->ud);
                                break;
+                       case '\v':
+                               func->ucl_emitter_append_len ("\\v", 2, func->ud);
+                               break;
                        case '\\':
                                func->ucl_emitter_append_len ("\\\\", 2, func->ud);
                                break;
+                       case ' ':
+                               func->ucl_emitter_append_character (' ', 1, func->ud);
+                               break;
                        case '"':
                                func->ucl_emitter_append_len ("\\\"", 2, func->ud);
                                break;