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 206AB4196F0 for ; Thu, 1 Apr 2010 04:40:46 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0.8 X-Spam-Level: X-Spam-Status: No, score=0.8 tagged_above=-999 required=5 tests=[BAYES_50=0.8] 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 kk5maBuC++s7 for ; Thu, 1 Apr 2010 04:40:45 -0700 (PDT) Received: from pivot.cs.unb.ca (pivot.cs.unb.ca [131.202.240.57]) by olra.theworths.org (Postfix) with ESMTP id 357B8431FC1 for ; Thu, 1 Apr 2010 04:40:45 -0700 (PDT) Received: from fctnnbsc30w-142167190087.pppoe-dynamic.high-speed.nb.bellaliant.net ([142.167.190.87] helo=rocinante.cs.unb.ca) by pivot.cs.unb.ca with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1NxIlP-00082w-Pu; Thu, 01 Apr 2010 08:40:44 -0300 Received: from bremner by rocinante.cs.unb.ca with local (Exim 4.71) (envelope-from ) id 1NxIlJ-0007LM-HD; Thu, 01 Apr 2010 08:40:37 -0300 From: David Bremner To: Gregor Hoffleit , notmuch In-Reply-To: <1267699753-sup-3919@sam.mediasupervision.de> References: <1267699753-sup-3919@sam.mediasupervision.de> Date: Thu, 01 Apr 2010 08:40:37 -0300 Message-ID: <871vezs8ne.fsf@rocinante.cs.unb.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Sender-Verified: bremner@pivot.cs.unb.ca 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: Thu, 01 Apr 2010 11:40:46 -0000 On Thu, 04 Mar 2010 11:49:48 +0100, Gregor Hoffleit wrote: > In format_part_json, part_content->data is not a null terminated > string. I'd like to see this bug fixed, and the patch is pretty small, but... > Instead, we have to use part_content->len. > + content_data = talloc_size (ctx, part_content->len+1); > + memcpy (content_data, (char *)part_content->data, part_content->len+1); Can anyone explain why we copy (what seems to me to be) one extra byte here? In principle reading outside our allocated memory could cause problems; at minimum it makes a false positive for a memory checker like valgrind. David