]> git.ipfire.org Git - thirdparty/grub.git/commit
lib/json/json: Add function to unescape JSON-encoded strings
authorPatrick Steinhardt <ps@pks.im>
Mon, 15 Aug 2022 15:52:59 +0000 (17:52 +0200)
committerDaniel Kiper <daniel.kiper@oracle.com>
Fri, 19 Aug 2022 21:55:50 +0000 (23:55 +0200)
commitb4055ebb8b3c1bbbc068f28099bd04b73df6fb67
treece092deda3d78d7413d0191957370f28ac995231
parent5730424cb91b8215c8aa10ae35681dc7273522d9
lib/json/json: Add function to unescape JSON-encoded strings

JSON strings require certain characters to be encoded, either by using
a single reverse solidus character "\" for a set of popular characters,
or by using a Unicode representation of "\uXXXXX". The jsmn library
doesn't handle unescaping for us, so we must implement this functionality
for ourselves.

Add a new function grub_json_unescape() that takes a potentially
escaped JSON string as input and returns a new unescaped string.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Reviewed-by: Daniel Kiper <dkiper@net-space.pl>
grub-core/lib/json/json.c
grub-core/lib/json/json.h