[PATCH v2 10/14] cli/reply: check for NULL list first in scan_address_list()
authorJani Nikula <jani@nikula.org>
Sat, 13 Aug 2016 11:37:34 +0000 (14:37 +0300)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 23:22:25 +0000 (16:22 -0700)
66/5dbc8d2b6c1116e345233d355d19600835cdd2 [new file with mode: 0644]

diff --git a/66/5dbc8d2b6c1116e345233d355d19600835cdd2 b/66/5dbc8d2b6c1116e345233d355d19600835cdd2
new file mode 100644 (file)
index 0000000..31e7a0a
--- /dev/null
@@ -0,0 +1,115 @@
+Return-Path: <jani@nikula.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 1273B6DE362A\r
+ for <notmuch@notmuchmail.org>; Sat, 13 Aug 2016 04:40:55 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.263\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.263 tagged_above=-999 required=5 tests=[AWL=0.983, \r
+ DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7,\r
+ RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id YT4BtQA3brrt for <notmuch@notmuchmail.org>;\r
+ Sat, 13 Aug 2016 04:40:47 -0700 (PDT)\r
+Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com\r
+ [74.125.82.68]) by arlo.cworth.org (Postfix) with ESMTPS id B97FD6DE396B for\r
+ <notmuch@notmuchmail.org>; Sat, 13 Aug 2016 04:39:18 -0700 (PDT)\r
+Received: by mail-wm0-f68.google.com with SMTP id i138so2004561wmf.3\r
+ for <notmuch@notmuchmail.org>; Sat, 13 Aug 2016 04:39:18 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=nikula-org.20150623.gappssmtp.com; s=20150623;\r
+ h=from:to:cc:subject:date:message-id:in-reply-to:references\r
+ :in-reply-to:references;\r
+ bh=7tsiGkg0FFMzDlQ3hfJSIFhyiHhCYGrgYwx2Ox7gEOc=;\r
+ b=UVhi+QUjwZw1SZqSrybZOrF0QUN6p93rPTqsnwRVxoSuyRczSn/mAuUUV+ZSSYLLzb\r
+ zVEd11PFwLpjke4FlbKT7hkP60/fo1SZvUBW4RYs9igqEeYtPLr+FEZBvvdJqvCFNe63\r
+ de2HWomCUx0Azv7LJFPNgjDfoRvvqp1Gktn2xBq7Dt5EhxGRouyXUlNyFUhQ4pvA+aT2\r
+ jTbfp+1zv6j5eiwaQk/zW8Wnq8luoyjX8WhRxvrVqjlA52260IG5p1fspCWEqN23WNB+\r
+ /ycEiLHHBIbPNxkiMr9b/LHFdNPOhmLB30vwKbzzlujBlxp1GBl5gV8j3RNQAFNMAzP6\r
+ pftw==\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\r
+ :references:in-reply-to:references;\r
+ bh=7tsiGkg0FFMzDlQ3hfJSIFhyiHhCYGrgYwx2Ox7gEOc=;\r
+ b=cIcYV2ZFIRw25/cs1B8N/2U89BHnV4FDLIqZy1BHfLAOhN5L8FrhnqevNHusYInZGC\r
+ YW5mM+oS1+Yxl9tMUL9JO9kEV/essV1dsoRYNYHycLSQFrbl9IYXKRHxGdWTfb9/yb+P\r
+ A/lZPMOMMu/eAWbGCZ27652B4l4DGZ9rkUKotzboK+zp0ayJFM7e2kXuh/5LdVtwiP4L\r
+ U8DxBHM/IXApAyYyPvrnLHknJ89BG/btmE0i7WUgyvCWEol2aKnezE/OnQdp+9/HeD2+\r
+ ayLwmcs2+069nMHLRbIjnX2JvTpXAnGpnYF4lfyFKShBKSqAPGBio+DO5SkbKvzi4DKv\r
+ xX/Q==\r
+X-Gm-Message-State:\r
+ AEkoousiAGDDQHyncnqKV9D2U5FdHyQto9YtjrNgJzbQhJdDMuSYzxTyWxSDUzhFHDOJ0w==\r
+X-Received: by 10.28.111.4 with SMTP id k4mr3821636wmc.94.1471088357407;\r
+ Sat, 13 Aug 2016 04:39:17 -0700 (PDT)\r
+Received: from localhost (dsl-hkibrasgw2-58c368-70.dhcp.inet.fi.\r
+ [88.195.104.70])\r
+ by smtp.gmail.com with ESMTPSA id gg10sm11785883wjd.4.2016.08.13.04.39.16\r
+ (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
+ Sat, 13 Aug 2016 04:39:17 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Cc: Daniel Kahn Gillmor <dkg@fifthhorseman.net>,\r
+       jani@nikula.org\r
+Subject: [PATCH v2 10/14] cli/reply: check for NULL list first in\r
+ scan_address_list()\r
+Date: Sat, 13 Aug 2016 14:37:34 +0300\r
+Message-Id:\r
+ <275a85feea6afa5226d362f73e193694ea25e0b0.1471088022.git.jani@nikula.org>\r
+X-Mailer: git-send-email 2.1.4\r
+In-Reply-To: <cover.1471088022.git.jani@nikula.org>\r
+References: <cover.1471088022.git.jani@nikula.org>\r
+In-Reply-To: <cover.1471088022.git.jani@nikula.org>\r
+References: <cover.1471088022.git.jani@nikula.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://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: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 13 Aug 2016 11:40:55 -0000\r
+\r
+Support passing NULL list later on. Also use it to simplify the\r
+recursion.\r
+---\r
+ notmuch-reply.c | 6 +++---\r
+ 1 file changed, 3 insertions(+), 3 deletions(-)\r
+\r
+diff --git a/notmuch-reply.c b/notmuch-reply.c\r
+index 9b78ea2c2b20..d90f46f9bed3 100644\r
+--- a/notmuch-reply.c\r
++++ b/notmuch-reply.c\r
+@@ -192,6 +192,9 @@ scan_address_list (InternetAddressList *list,\r
+     int i;\r
+     unsigned int n = 0;\r
\r
++    if (list == NULL)\r
++      return 0;\r
++\r
+     for (i = 0; i < internet_address_list_length (list); i++) {\r
+       address = internet_address_list_get_address (list, i);\r
+       if (INTERNET_ADDRESS_IS_GROUP (address)) {\r
+@@ -200,9 +203,6 @@ scan_address_list (InternetAddressList *list,\r
\r
+           group = INTERNET_ADDRESS_GROUP (address);\r
+           group_list = internet_address_group_get_members (group);\r
+-          if (group_list == NULL)\r
+-              continue;\r
+-\r
+           n += scan_address_list (group_list, config, message, type, user_from);\r
+       } else {\r
+           InternetAddressMailbox *mailbox;\r
+-- \r
+2.1.4\r
+\r