9front - general discussion about 9front
 help / color / mirror / Atom feed
From: Kristo <kristo.ilmari@gmail.com>
To: 9front <9front@9front.org>
Subject: [9front] [PATCH] libjson: make sure string contains only a single JSON value
Date: Mon, 7 Aug 2023 18:29:08 +0300	[thread overview]
Message-ID: <CAAJ3RaMYfxOZ4dxMuke+11LPUVL5Ak6gZuqifzWmZQOGs1bWpw@mail.gmail.com> (raw)

diff bf645afaac246967b9590ae7463f243c11d97480 uncommitted
--- 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;
 }

             reply	other threads:[~2023-08-07 15:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-07 15:29 Kristo [this message]
2023-08-07 22:16 ` ori
2023-08-08 14:44   ` [9front] " Kristo
2023-09-18 11:26     ` Kristo
2023-09-18 12:59 ` ori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAAJ3RaMYfxOZ4dxMuke+11LPUVL5Ak6gZuqifzWmZQOGs1bWpw@mail.gmail.com \
    --to=kristo.ilmari@gmail.com \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).