ref: 172dc0005aa16dea8451bf2bcef7f3eb04df2c04
parent: 597ff0b59658032e141553f286e02b9370f995b5
author: Kristo <[email protected]>
date: Mon Aug 7 11:29:08 EDT 2023
libjson: make sure string contains only a single JSON value
--- a/sys/src/libjson/json.c
+++ b/sys/src/libjson/json.c
@@ -328,6 +328,13 @@
j = jsonobj(&l);
free(l.buf);
+
+ if(peeknonspace(&l) != 0){
+ jsonfree(j);
+ werrstr("json: unexpected trailing data");
+ return nil;
+ }
+
return j;
}