Re: [notmuch] [PATCH] format_part_json: part_content->data is not null terminated
authorMichal Sojka <sojkam1@fel.cvut.cz>
Thu, 1 Apr 2010 12:05:06 +0000 (14:05 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:36:28 +0000 (09:36 -0800)
90/95e4c52089103a7adc888636f5cbeeab699a05 [new file with mode: 0644]

diff --git a/90/95e4c52089103a7adc888636f5cbeeab699a05 b/90/95e4c52089103a7adc888636f5cbeeab699a05
new file mode 100644 (file)
index 0000000..58030e5
--- /dev/null
@@ -0,0 +1,76 @@
+Return-Path: <sojkam1@fel.cvut.cz>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 153864196F0\r
+       for <notmuch@notmuchmail.org>; Thu,  1 Apr 2010 05:05:11 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.9\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5\r
+       tests=[BAYES_00=-1.9] autolearn=ham\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id WV8kxvgmGg0l for <notmuch@notmuchmail.org>;\r
+       Thu,  1 Apr 2010 05:05:10 -0700 (PDT)\r
+Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36])\r
+       by olra.theworths.org (Postfix) with ESMTP id 5ABC3431FC1\r
+       for <notmuch@notmuchmail.org>; Thu,  1 Apr 2010 05:05:10 -0700 (PDT)\r
+Received: from localhost (unknown [192.168.200.4])\r
+       by max.feld.cvut.cz (Postfix) with ESMTP id 3BB9519F35D1;\r
+       Thu,  1 Apr 2010 14:05:09 +0200 (CEST)\r
+X-Virus-Scanned: IMAP AMAVIS\r
+Received: from max.feld.cvut.cz ([192.168.200.1])\r
+       by localhost (styx.feld.cvut.cz [192.168.200.4]) (amavisd-new,\r
+       port 10044)\r
+       with ESMTP id JjTmf-aHcwQX; Thu,  1 Apr 2010 14:05:07 +0200 (CEST)\r
+Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34])\r
+       by max.feld.cvut.cz (Postfix) with ESMTP id EF51819F33C6;\r
+       Thu,  1 Apr 2010 14:05:06 +0200 (CEST)\r
+Received: from steelpick.2x.cz (k335-30.felk.cvut.cz [147.32.86.30])\r
+       (Authenticated sender: sojkam1)\r
+       by imap.feld.cvut.cz (Postfix) with ESMTPSA id A65B4FA003;\r
+       Thu,  1 Apr 2010 14:05:06 +0200 (CEST)\r
+Received: from wsh by steelpick.2x.cz with local (Exim 4.71)\r
+       (envelope-from <sojkam1@fel.cvut.cz>)\r
+       id 1NxJ90-0004YW-AD; Thu, 01 Apr 2010 14:05:06 +0200\r
+From: Michal Sojka <sojkam1@fel.cvut.cz>\r
+To: David Edmondson <dme@dme.org>, David Bremner <david@tethera.net>,\r
+       Gregor Hoffleit <gregor@hoffleit.de>, notmuch <notmuch@notmuchmail.org>\r
+In-Reply-To: <87634bjsrl.fsf@ut.hh.sledj.net>\r
+References: <1267699753-sup-3919@sam.mediasupervision.de>\r
+       <871vezs8ne.fsf@rocinante.cs.unb.ca>\r
+       <87634bjsrl.fsf@ut.hh.sledj.net>\r
+Date: Thu, 01 Apr 2010 14:05:06 +0200\r
+Message-ID: <874ojv5qfh.fsf@steelpick.2x.cz>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Subject: Re: [notmuch] [PATCH] format_part_json: part_content->data is not\r
+       null terminated\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 01 Apr 2010 12:05:11 -0000\r
+\r
+On Thu, 04 Mar 2010, Gregor Hoffleit wrote:\r
+> -    printf (", \"content\": %s", json_quote_str (ctx, (char *) part_content->data));\r
+> +    content_data = talloc_size (ctx, part_content->len+1);\r
+> +    memcpy (content_data, (char *)part_content->data, part_content->len+1);\r
+> +    content_data[part_content->len] = 0;\r
+> +    printf (", \"content\": %s", json_quote_str (ctx, content_data));\r
+\r
+What about modifying json_quote_str() to accept additional parameter\r
+len? If I have 10MB attachment to the email, this unnecessary copy is\r
+quite expensive, isn't it?\r
+\r
+--Michal\r