1 Return-Path: <cworth@cworth.org>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id A0C284196F2
\r
6 for <notmuch@notmuchmail.org>; Tue, 20 Apr 2010 08:59:52 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-2.89 tagged_above=-999 required=5
\r
12 tests=[ALL_TRUSTED=-1, BAYES_00=-1.9, T_MIME_NO_TEXT=0.01]
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id TZIevhlelrAr; Tue, 20 Apr 2010 08:59:51 -0700 (PDT)
\r
17 Received: from yoom.home.cworth.org (localhost [127.0.0.1])
\r
18 by olra.theworths.org (Postfix) with ESMTP id 4ED35431FC1;
\r
19 Tue, 20 Apr 2010 08:59:51 -0700 (PDT)
\r
20 Received: by yoom.home.cworth.org (Postfix, from userid 1000)
\r
21 id 6CA6525400A; Tue, 20 Apr 2010 08:59:52 -0700 (PDT)
\r
22 From: Carl Worth <cworth@cworth.org>
\r
23 To: Anthony Towns <aj@erisian.com.au>, David Edmondson <dme@dme.org>
\r
24 Subject: Re: [PATCH] json: Avoid calling strlen(NULL)
\r
25 In-Reply-To: <h2y87b3a4191004060117v5421db8ejbe3030d0626e7440@mail.gmail.com>
\r
26 References: <877holavq5.fsf@ut.hh.sledj.net>
\r
27 <h2y87b3a4191004060117v5421db8ejbe3030d0626e7440@mail.gmail.com>
\r
28 Date: Tue, 20 Apr 2010 08:59:52 -0700
\r
29 Message-ID: <878w8iw1vr.fsf@yoom.home.cworth.org>
\r
31 Content-Type: multipart/signed; boundary="=-=-=";
\r
32 micalg=pgp-sha1; protocol="application/pgp-signature"
\r
33 Cc: notmuch <notmuch@notmuchmail.org>
\r
34 X-BeenThere: notmuch@notmuchmail.org
\r
35 X-Mailman-Version: 2.1.13
\r
37 List-Id: "Use and development of the notmuch mail system."
\r
38 <notmuch.notmuchmail.org>
\r
39 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
40 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
41 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
42 List-Post: <mailto:notmuch@notmuchmail.org>
\r
43 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
44 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
45 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
46 X-List-Received-Date: Tue, 20 Apr 2010 15:59:52 -0000
\r
49 Content-Transfer-Encoding: quoted-printable
\r
51 > There's already a check in json_quote_chararray for len=3D=3D0, so it
\r
52 > might be sensible to say:
\r
54 > return (json_quote_chararray (ctx, str, str !=3D NULL ? strlen (str) =
\r
57 > OTOH, the code in json_quote_array to deal with that does the same
\r
58 > thing (returns a literal string containing two quote marks), which
\r
59 > seems wrong -- the normal code path is to talloc to get a newly
\r
60 > allocated, editable string, that might be talloc_free'd later,
\r
61 > wouldn't it make more sense just to let the str=3D=3DNULL / len=3D=3D0
\r
62 > behaviour fall through into the normal case code?
\r
64 Yes, that's the correct analysis. Thanks so much.
\r
66 > commit 5b93a488221b50c02db18d86a550cb3c038c00da
\r
67 > Author: Anthony <aj@erisian.com.au>
\r
68 > Date: Tue Apr 6 18:10:39 2010 +1000
\r
70 > json: Avoid calling strlen(NULL), and always return a newly
\r
74 I've pushed this out now, (separated into two pieces).
\r
79 Content-Type: application/pgp-signature
\r
81 -----BEGIN PGP SIGNATURE-----
\r
82 Version: GnuPG v1.4.10 (GNU/Linux)
\r
84 iD8DBQFLzc946JDdNq8qSWgRAsP1AJ9fgpBe6+hZRrq8FRJV3l50kzpv8QCfcal/
\r
85 i0IWzEcB2C/hBqtiZ3VIu2Q=
\r
87 -----END PGP SIGNATURE-----
\r