[RFC PATCH 2/6] cli/reply: check for NULL list first in scan_address_list()
authorJani Nikula <jani@nikula.org>
Sun, 19 Jun 2016 20:15:30 +0000 (23:15 +0300)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 23:22:07 +0000 (16:22 -0700)
38/dcf7670eaf96c1e1079a7191a8408ce64a7b3f [new file with mode: 0644]

diff --git a/38/dcf7670eaf96c1e1079a7191a8408ce64a7b3f b/38/dcf7670eaf96c1e1079a7191a8408ce64a7b3f
new file mode 100644 (file)
index 0000000..30e41cc
--- /dev/null
@@ -0,0 +1,116 @@
+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 BE4F26DE0363\r
+ for <notmuch@notmuchmail.org>; Sun, 19 Jun 2016 13:17:18 -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.448\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.448 tagged_above=-999 required=5 tests=[AWL=1.168, \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 4FhzPs5LzdrO for <notmuch@notmuchmail.org>;\r
+ Sun, 19 Jun 2016 13:17:11 -0700 (PDT)\r
+Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com\r
+ [74.125.82.65]) by arlo.cworth.org (Postfix) with ESMTPS id 273186DE01CE for\r
+ <notmuch@notmuchmail.org>; Sun, 19 Jun 2016 13:17:05 -0700 (PDT)\r
+Received: by mail-wm0-f65.google.com with SMTP id c82so6633535wme.3\r
+ for <notmuch@notmuchmail.org>; Sun, 19 Jun 2016 13:17:05 -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=z4yJvkXiroT3Ifnj5pOwz3QPPs159J7pxhfCBbgCyfZZxoHnZNPa7pga55psod9bSx\r
+ HSh+GdfxRUqo2+TggVcJmLnf3GrBSYIgOjIQz/gSDoJbr8mU1yWbFeO1osQHCFWvAv8o\r
+ C7hlmJ5DRScV7ImD0kJNiqJcA1K8s9JQVPX/ma4/sn2g9fHSCgHvzwsmoep9tjhBX2Oc\r
+ sHDlrCQXJmEzi9AIPNXSoGsIUR5Ja3bcyDE35z7a1nIiC6oGoRI3l0u64EMBcmrmakFG\r
+ eny53ns9uCUZmc1KX4gT7B5hwzfQzZ41dBkbSbm9mRX1UwXbD1Rc/HbR8LalsFYDQWzN\r
+ doTg==\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=K5hyu5qzOtYkAkWqswHPS/olSSwr9i/IqOZyOy0+u9v60wZEJgvQ4qQVvXFOCSDFEp\r
+ SOC2lnCHBhUC3GFr/Kr95prZNTS530OjP/oaRgwYr2BuBrzCC5Nu9cdhXKyyfYf/doto\r
+ wtFpZLT9i2/K8O+UkMtjkedaX63UXr/lyVGC3XE+6m/zkUZk7uwmgi3jWyN4Hqb2Mp7c\r
+ mvFA9fhJ2cb0s0R/xMgqQMqZCH7J4sYrNFjTv9YRyUJGUfgDRWLdeK+z086wkpUMQc/Z\r
+ LUHH0R2xrDsP3wzZIpKbYmi/yzau8MSElvi1UFsUrDefAxjzXvnyhx5O14rXMCST/hv2\r
+ V6yQ==\r
+X-Gm-Message-State:\r
+ ALyK8tKUR/zW3TE50Elv9D1o/RrpovUAwbnwEj6WM0H2xKQEOHFTmGCd8RBCOsVZ9IdDmA==\r
+X-Received: by 10.195.11.40 with SMTP id ef8mr11052618wjd.137.1466367423796;\r
+ Sun, 19 Jun 2016 13:17:03 -0700 (PDT)\r
+Received: from localhost (dsl-hkibrasgw2-58c37a-44.dhcp.inet.fi.\r
+ [88.195.122.44])\r
+ by smtp.gmail.com with ESMTPSA id o2sm33403765wjp.26.2016.06.19.13.17.03\r
+ (version=TLSv1/SSLv3 cipher=OTHER);\r
+ Sun, 19 Jun 2016 13:17:03 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: Jani Nikula <jani@nikula.org>,\r
+       notmuch@notmuchmail.org\r
+Cc: Daniel Kahn Gillmor <dkg@fifthhorseman.net>\r
+Subject: [RFC PATCH 2/6] cli/reply: check for NULL list first in\r
+ scan_address_list()\r
+Date: Sun, 19 Jun 2016 23:15:30 +0300\r
+Message-Id:\r
+ <ab2abc39d4d4041228fda9beec05cc90b49e54b4.1466366737.git.jani@nikula.org>\r
+X-Mailer: git-send-email 2.1.4\r
+In-Reply-To: <cover.1466366737.git.jani@nikula.org>\r
+References: <cover.1466284726.git.jani@nikula.org>\r
+ <cover.1466366737.git.jani@nikula.org>\r
+In-Reply-To: <cover.1466366737.git.jani@nikula.org>\r
+References: <cover.1466366737.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: Sun, 19 Jun 2016 20:17:18 -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