From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 1E644431FAF for ; Mon, 7 Jan 2013 13:20:54 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled 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 BegcVXD4ELgN for ; Mon, 7 Jan 2013 13:20:53 -0800 (PST) Received: from dmz-mailsec-scanner-2.mit.edu (DMZ-MAILSEC-SCANNER-2.MIT.EDU [18.9.25.13]) by olra.theworths.org (Postfix) with ESMTP id 79FC5431FAE for ; Mon, 7 Jan 2013 13:20:53 -0800 (PST) X-AuditID: 1209190d-b7efd6d000001a82-c2-50eb3c353039 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35]) by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP id 5E.6C.06786.53C3BE05; Mon, 7 Jan 2013 16:20:53 -0500 (EST) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id r07LKqOO030143; Mon, 7 Jan 2013 16:20:52 -0500 Received: from drake.dyndns.org (a069.catapulsion.net [70.36.81.69]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id r07LKnXq004005 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Mon, 7 Jan 2013 16:20:51 -0500 (EST) Received: from amthrax by drake.dyndns.org with local (Exim 4.77) (envelope-from ) id 1TsK7k-0008Ms-CQ; Mon, 07 Jan 2013 16:20:48 -0500 From: Austin Clements To: notmuch@notmuchmail.org Subject: [PATCH] string-util: Disallow empty prefixes in parse_boolean_term Date: Mon, 7 Jan 2013 16:20:40 -0500 Message-Id: <1357593640-32122-1-git-send-email-amdragon@mit.edu> X-Mailer: git-send-email 1.7.10.4 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrEIsWRmVeSWpSXmKPExsUixCmqrGtq8zrAYMcONoum6c4W12/OZHZg 8rh1/zW7x7NVt5gDmKK4bFJSczLLUov07RK4MvbuPcJesIG1Yu3zU0wNjBNZuhg5OSQETCR6 33UyQthiEhfurWfrYuTiEBLYxyjR9fwoO4SznlGi4dwlJghnP5PE8g8/oMrmMko877rJDtLP JqAhsW3/crBZIgLSEjvvzmbtYuTgYBYwl7jZEtfFyM4hLOAtMV0IpIBFQFViz55JYI28Ag4S m85eZII4QlGi+9kEtgmMvAsYGVYxyqbkVunmJmbmFKcm6xYnJ+blpRbpGunlZpbopaaUbmIE B4Uk7w7GdweVDjEKcDAq8fC+dH0VIMSaWFZcmXuIUZKDSUmUd5Xl6wAhvqT8lMqMxOKM+KLS nNTiQ4wSHMxKIrzfHgCV86YkVlalFuXDpKQ5WJTEea+k3PQXEkhPLEnNTk0tSC2CycpwcChJ 8MpZAw0VLEpNT61Iy8wpQUgzcXCCDOcBGu4NUsNbXJCYW5yZDpE/xagoJc7rBZIQAElklObB 9cKi9hWjONArwrzaIFU8wIiH634FNJgJaHDq4+cgg0sSEVJSDYxyFoHbN1bfnZJwczpfZzcf BwfL7uz1nxg2pP6o++lyY7ai/Il5h0W8HBYekVt54lmtu3o/x9TUxB9fw+qEH7VG1pgHnWFN +dUy5VWk4XXdaW0cujusGrf7rgr1+vD1T2PZPVbF0/cunDy5JOiGU21SW1mKhfyyzlUFz/OK 7W/2nSl2exUgv1GJpTgj0VCLuag4EQCnzOVvtQIAAA== 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: Mon, 07 Jan 2013 21:20:54 -0000 Xapian doesn't consider ":abc" to be a prefixed term. This makes parse_boolean_term similarly reject queries with an empty prefix. --- util/string-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/string-util.c b/util/string-util.c index aba9aa8..a5622d7 100644 --- a/util/string-util.c +++ b/util/string-util.c @@ -127,7 +127,7 @@ parse_boolean_term (void *ctx, const char *str, /* Parse prefix */ str = skip_space (str); const char *pos = strchr (str, ':'); - if (! pos) + if (! pos || pos == str) goto FAIL; *prefix_out = talloc_strndup (ctx, str, pos - str); if (! *prefix_out) { -- 1.7.10.4