[notmuch] [PATCH] format_part_json: part_content->data is not null terminated
David Edmondson
dme at dme.org
Mon Apr 5 02:36:38 PDT 2010
On Thu, 01 Apr 2010 14:05:06 +0200, Michal Sojka <sojkam1 at fel.cvut.cz> 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
More information about the notmuch
mailing list