Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 85A864196F4 for ; Mon, 5 Apr 2010 02:36:49 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.9 X-Spam-Level: X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9] autolearn=ham Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id b124mwwkVTWa for ; Mon, 5 Apr 2010 02:36:48 -0700 (PDT) Received: from mail-wy0-f181.google.com (mail-wy0-f181.google.com [74.125.82.181]) by olra.theworths.org (Postfix) with ESMTP id 0E7734196F0 for ; Mon, 5 Apr 2010 02:36:47 -0700 (PDT) Received: by wyj26 with SMTP id 26so1415250wyj.26 for ; Mon, 05 Apr 2010 02:36:47 -0700 (PDT) Received: by 10.216.174.129 with SMTP id x1mr3087115wel.140.1270460206850; Mon, 05 Apr 2010 02:36:46 -0700 (PDT) Received: from ut.hh.sledj.net (host83-217-165-81.dsl.vispa.com [83.217.165.81]) by mx.google.com with ESMTPS id p10sm24844022gvf.22.2010.04.05.02.36.39 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 05 Apr 2010 02:36:40 -0700 (PDT) Received: by ut.hh.sledj.net (Postfix, from userid 1000) id 2153A5941EC; Mon, 5 Apr 2010 10:36:38 +0100 (BST) To: Michal Sojka , David Bremner , Gregor Hoffleit , notmuch In-Reply-To: <874ojv5qfh.fsf@steelpick.2x.cz> References: <1267699753-sup-3919@sam.mediasupervision.de> <871vezs8ne.fsf@rocinante.cs.unb.ca> <87634bjsrl.fsf@ut.hh.sledj.net> <874ojv5qfh.fsf@steelpick.2x.cz> From: David Edmondson Date: Mon, 05 Apr 2010 10:36:38 +0100 Message-ID: <878w929r6h.fsf@ut.hh.sledj.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [notmuch] [PATCH] format_part_json: part_content->data is not null terminated X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Apr 2010 09:36:49 -0000 On Thu, 01 Apr 2010 14:05:06 +0200, Michal Sojka wrote: > On Thu, 04 Mar 2010, Gregor Hoffleit wrote: > > - printf (", \"content\": %s", json_quote_str (ctx, (char *) part_content->data)); > > + content_data = talloc_size (ctx, part_content->len+1); > > + memcpy (content_data, (char *)part_content->data, part_content->len+1); > > + content_data[part_content->len] = 0; > > + printf (", \"content\": %s", json_quote_str (ctx, content_data)); > > What about modifying json_quote_str() to accept additional parameter > len? If I have 10MB attachment to the email, this unnecessary copy is > quite expensive, isn't it? Agreed. How about this patch: http://github.com/dme/notmuch/commit/5f23ae341788d28e455e53488d184d8caaa618c5 ? dme. -- David Edmondson, http://dme.org