git: 9front

Download patch

ref: 02b57c652300e52e2a2296c19caf8a2ef7c115e5
parent: 75b722e8bc75f8096d1879cdd0ef14c13df652ca
author: Kristo <kristo.ilmari@gmail.com>
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;
 }
 
--