diff --git a/src/util/virjson.c b/src/util/virjson.c index 4257b30e69d0de7a6c9ac7df8c5dd1ee507ae041..8d12fadb3f59637087522f30e194fb591992087e 100644 --- a/src/util/virjson.c +++ b/src/util/virjson.c @@ -1596,7 +1596,7 @@ virJSONValueFromString(const char *jsonstring) int rc; size_t len = strlen(jsonstring); # ifndef WITH_YAJL2 - yajl_parser_config cfg = { 1, 1 }; + yajl_parser_config cfg = { 0, 1 }; # endif VIR_DEBUG("string=%s", jsonstring); @@ -1604,7 +1604,7 @@ virJSONValueFromString(const char *jsonstring) # ifdef WITH_YAJL2 hand = yajl_alloc(&parserCallbacks, NULL, &parser); if (hand) { - yajl_config(hand, yajl_allow_comments, 1); + yajl_config(hand, yajl_allow_comments, 0); yajl_config(hand, yajl_dont_validate_strings, 0); } # else diff --git a/tests/jsontest.c b/tests/jsontest.c index 8ac09708337a2683b6491e7820ac8b6320fca859..f6c2d84095d2206e111311e691f6ecaa72782da4 100644 --- a/tests/jsontest.c +++ b/tests/jsontest.c @@ -418,6 +418,7 @@ mymain(void) DO_TEST_PARSE_FAIL("incomplete keyword", "tr"); DO_TEST_PARSE_FAIL("overdone keyword", "[ truest ]"); DO_TEST_PARSE_FAIL("unknown keyword", "huh"); + DO_TEST_PARSE_FAIL("comments", "[ /* nope */\n1 // not this either\n]"); DO_TEST_PARSE_FAIL("object with numeric keys", "{ 1:1, 2:1, 3:2 }"); DO_TEST_PARSE_FAIL("unterminated object", "{ \"1\":1, \"2\":1, \"3\":2");