From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 Received: (qmail 31255 invoked from network); 7 Aug 2023 15:30:26 -0000 Received: from 9front.inri.net (168.235.81.73) by inbox.vuxu.org with ESMTPUTF8; 7 Aug 2023 15:30:26 -0000 Received: from mail-lf1-f50.google.com ([209.85.167.50]) by 9front; Mon Aug 7 11:29:12 -0400 2023 Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-4fe11652b64so7213591e87.0 for <9front@9front.org>; Mon, 07 Aug 2023 08:29:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691422149; x=1692026949; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=Leg+361iWso1oN1ynpi5mGOky+reMD/W0ZYWQ+3OqYQ=; b=KyG+LwyFSORdyBqqvMuFxGCzv4WhDjdECPz67FPI+3KCCo2j9rnVcMdAfIX3qxLDMZ ntTjAC58wtlvFEzTin7kdLtqV7C2FcU0R/bnX2x+CDsjnL+tfI7ON/CzqpdxFyS/DcIl Zd0Kodo/dAytwRB6EwDd0qEGMyXX9gOld0zKgbz5xqJM7yycvaUm+nriW4EnZvPaiLGE xGY36Lqft38LliAeEyOfWoMYvn/XZmywJ5ZT4z0zRbUOXX2ZZzuQHrYqCSC+RlM6mnW0 QtemFytHeHDMWELpAXikiCpGlMSUF0YOoRdayD7jwtkG5dCYTFZT0GDif8Ba/tKEvV0o yQAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691422149; x=1692026949; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Leg+361iWso1oN1ynpi5mGOky+reMD/W0ZYWQ+3OqYQ=; b=DtZcwUeDlo4G8VaREeLCJRzm+d+tYe+K3BI6XRx74OdC4dpY94SZpcI30vEc5eSDLt eHRXhWS+JcSJlet3mQUEa0/zRYaHSdz5ehHq2FPDfPWaGlov5KiPVWZtZYJfj+1W7Azn 8piTGsgjdNSbiToIP0Yy9T2oQ0kCVWRAkqHHycqznldJ01iGLAmVF9wqa62e1xhpdZSI s0enjcNxVpoksV59Raf4Nz6KHO5gpcrKm1aD52ga5sfE/qscziEXmG0GmotsOEjzjc5k 2USX4SiX8FmOb6StX9mhCKvLSW4A3fTFyrY/AaEEfF31lO8soVeYlNMHHEA51q5WVihK 6XJg== X-Gm-Message-State: AOJu0Yz3JVXgXA3SZzcKk2w9Xy17zpm4TX+DuHpAMeBJxsdoIsC/goPh a2UPFHCFnfZNW1m7/hckaxOw6xxg3pRDrNq6l2XXQv10 X-Google-Smtp-Source: AGHT+IFozahDGauXCoj9bohJAMuDNRPZtAXBpiM1hU9SAs1ekmP+ePoNAWD2JhTlS2pEqcFFAlUm/VrNyHYEB3O/cVY= X-Received: by 2002:a19:655d:0:b0:4f8:752f:371f with SMTP id c29-20020a19655d000000b004f8752f371fmr5736915lfj.51.1691422148653; Mon, 07 Aug 2023 08:29:08 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a05:7208:c087:b0:70:dd78:ba20 with HTTP; Mon, 7 Aug 2023 08:29:08 -0700 (PDT) From: Kristo Date: Mon, 7 Aug 2023 18:29:08 +0300 Message-ID: To: 9front <9front@9front.org> Content-Type: text/plain; charset="UTF-8" List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: session callback optimizer Subject: [9front] [PATCH] libjson: make sure string contains only a single JSON value Reply-To: 9front@9front.org Precedence: bulk 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; }