Re: [PATCH] string-util: Disallow empty prefixes in parse_boolean_term
authorJani Nikula <jani@nikula.org>
Mon, 7 Jan 2013 22:12:43 +0000 (00:12 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:53:02 +0000 (09:53 -0800)
2f/fb633f2519f835f4bbe6876b9f3599e63b6455 [new file with mode: 0644]

diff --git a/2f/fb633f2519f835f4bbe6876b9f3599e63b6455 b/2f/fb633f2519f835f4bbe6876b9f3599e63b6455
new file mode 100644 (file)
index 0000000..67b30e6
--- /dev/null
@@ -0,0 +1,94 @@
+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 olra.theworths.org (Postfix) with ESMTP id A0573431FAE\r
+       for <notmuch@notmuchmail.org>; Mon,  7 Jan 2013 14:12:55 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\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 aOhyYbizu7HT for <notmuch@notmuchmail.org>;\r
+       Mon,  7 Jan 2013 14:12:51 -0800 (PST)\r
+Received: from mail-la0-f48.google.com (mail-la0-f48.google.com\r
+       [209.85.215.48]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 0C4C2431FAF\r
+       for <notmuch@notmuchmail.org>; Mon,  7 Jan 2013 14:12:50 -0800 (PST)\r
+Received: by mail-la0-f48.google.com with SMTP id ej20so17094892lab.21\r
+       for <notmuch@notmuchmail.org>; Mon, 07 Jan 2013 14:12:48 -0800 (PST)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+       d=google.com; s=20120113;\r
+       h=x-received:from:to:cc:subject:in-reply-to:references:user-agent\r
+       :date:message-id:mime-version:content-type:x-gm-message-state;\r
+       bh=W67jVbpVazWg8zbuuNYvfqsu4yjM6pOWZBhQfb/bqiQ=;\r
+       b=D08cDpdhSg8UlPZ+bQ8vjzLI6kUe6MlCHnwqVQdCZ+g84Q9iHYMP8gGAOfnz4qiC2l\r
+       h/+cs8ns4TN+BqOMYHnDpnmQ8dQTtZQ3bOpfdlN3SRDkauuW0Vtckr/qFWSXy0is0XFf\r
+       WHHAwIyoH4KQpGK6AxB4S0158ZrgD7pby2vPEXHu/rRMOCinQgvaTqJ3uiVWM9VHIQ98\r
+       jTuHKP3yYZoVEtEP8nlvuPhjljWidiHQNXX/pc6H5vZymgxmwXz7OA0Dgr3Ftdn/J8Ko\r
+       c88ypkuDpX4d1jqPL+vtHIx+is7NlhDXviTYHOSDVKKUK9ZNFNIC1AxvN1XqeORBV55B\r
+       0K7w==\r
+X-Received: by 10.152.125.136 with SMTP id mq8mr59789967lab.41.1357596766759; \r
+       Mon, 07 Jan 2013 14:12:46 -0800 (PST)\r
+Received: from localhost (dsl-hkibrasgw4-50df51-27.dhcp.inet.fi.\r
+       [80.223.81.27])\r
+       by mx.google.com with ESMTPS id ee5sm21849707lbb.14.2013.01.07.14.12.44\r
+       (version=SSLv3 cipher=OTHER); Mon, 07 Jan 2013 14:12:45 -0800 (PST)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: Austin Clements <amdragon@MIT.EDU>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] string-util: Disallow empty prefixes in\r
+ parse_boolean_term\r
+In-Reply-To: <1357593640-32122-1-git-send-email-amdragon@mit.edu>\r
+References: <1357593640-32122-1-git-send-email-amdragon@mit.edu>\r
+User-Agent: Notmuch/0.14+211~gc8d6546 (http://notmuchmail.org) Emacs/24.2.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Tue, 08 Jan 2013 00:12:43 +0200\r
+Message-ID: <87ip78ej6s.fsf@nikula.org>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-Gm-Message-State:\r
+ ALoCoQlfmd4MXYahAi+gd7FV3R0WRMJw99BvQHl4taF6MjAAXSH5nOP5zrihxzQ+bQL5ktTfa3Mr\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: Mon, 07 Jan 2013 22:12:55 -0000\r
+\r
+On Mon, 07 Jan 2013, Austin Clements <amdragon@MIT.EDU> wrote:\r
+> Xapian doesn't consider ":abc" to be a prefixed term.  This makes\r
+> parse_boolean_term similarly reject queries with an empty prefix.\r
+\r
+LGTM,\r
+Jani.\r
+\r
+> ---\r
+>  util/string-util.c |    2 +-\r
+>  1 file changed, 1 insertion(+), 1 deletion(-)\r
+>\r
+> diff --git a/util/string-util.c b/util/string-util.c\r
+> index aba9aa8..a5622d7 100644\r
+> --- a/util/string-util.c\r
+> +++ b/util/string-util.c\r
+> @@ -127,7 +127,7 @@ parse_boolean_term (void *ctx, const char *str,\r
+>      /* Parse prefix */\r
+>      str = skip_space (str);\r
+>      const char *pos = strchr (str, ':');\r
+> -    if (! pos)\r
+> +    if (! pos || pos == str)\r
+>      goto FAIL;\r
+>      *prefix_out = talloc_strndup (ctx, str, pos - str);\r
+>      if (! *prefix_out) {\r
+> -- \r
+> 1.7.10.4\r