]> git.ipfire.org Git - thirdparty/libvirt.git/commit
json: even stricter trailing garbage detection
authorEric Blake <eblake@redhat.com>
Mon, 22 Jun 2015 21:01:15 +0000 (15:01 -0600)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 25 Jun 2015 07:11:15 +0000 (09:11 +0200)
commit7e191fd939f04ccff58d9a17bdc68db3bdb8424d
tree0b5c5ea9bb5ea36409762fb87f11e2643b4fda6b
parent7cd991b74c5f22ead826a71d1427354b1a80915e
json: even stricter trailing garbage detection

Since older yajl ignores trailing garbage, a client can cause
problems by intentionally ending the wrapper array early. Since
we already track nesting, it's not too much harder to reject
invalid nesting pops.

* src/util/virjson. (_virJSONParser): Add field.
(virJSONValueFromString): Set witness.
(virJSONParserHandleEndArray): Use it to catch abuse.
* tests/jsontest.c (mymain): Test it.

Signed-off-by: Eric Blake <eblake@redhat.com>
src/util/virjson.c
tests/jsontest.c