unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] string-util: Disallow empty prefixes in parse_boolean_term
@ 2013-01-07 21:20 Austin Clements
  2013-01-07 22:12 ` Jani Nikula
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Austin Clements @ 2013-01-07 21:20 UTC (permalink / raw)
  To: notmuch

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] string-util: Disallow empty prefixes in parse_boolean_term
  2013-01-07 21:20 [PATCH] string-util: Disallow empty prefixes in parse_boolean_term Austin Clements
@ 2013-01-07 22:12 ` Jani Nikula
  2013-01-08  0:37 ` David Bremner
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Jani Nikula @ 2013-01-07 22:12 UTC (permalink / raw)
  To: Austin Clements, notmuch

On Mon, 07 Jan 2013, Austin Clements <amdragon@MIT.EDU> wrote:
> Xapian doesn't consider ":abc" to be a prefixed term.  This makes
> parse_boolean_term similarly reject queries with an empty prefix.

LGTM,
Jani.

> ---
>  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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] string-util: Disallow empty prefixes in parse_boolean_term
  2013-01-07 21:20 [PATCH] string-util: Disallow empty prefixes in parse_boolean_term Austin Clements
  2013-01-07 22:12 ` Jani Nikula
@ 2013-01-08  0:37 ` David Bremner
  2013-01-08  0:58 ` David Bremner
  2013-01-08  3:04 ` David Bremner
  3 siblings, 0 replies; 5+ messages in thread
From: David Bremner @ 2013-01-08  0:37 UTC (permalink / raw)
  To: Austin Clements, notmuch

Austin Clements <amdragon@MIT.EDU> writes:

> Xapian doesn't consider ":abc" to be a prefixed term.  This makes
> parse_boolean_term similarly reject queries with an empty prefix.

Looks OK to me.

d

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] string-util: Disallow empty prefixes in parse_boolean_term
  2013-01-07 21:20 [PATCH] string-util: Disallow empty prefixes in parse_boolean_term Austin Clements
  2013-01-07 22:12 ` Jani Nikula
  2013-01-08  0:37 ` David Bremner
@ 2013-01-08  0:58 ` David Bremner
  2013-01-08  3:04 ` David Bremner
  3 siblings, 0 replies; 5+ messages in thread
From: David Bremner @ 2013-01-08  0:58 UTC (permalink / raw)
  To: Austin Clements, notmuch

Austin Clements <amdragon@MIT.EDU> writes:

> Xapian doesn't consider ":abc" to be a prefixed term.  This makes
> parse_boolean_term similarly reject queries with an empty prefix.
> ---

pushed.

d

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] string-util: Disallow empty prefixes in parse_boolean_term
  2013-01-07 21:20 [PATCH] string-util: Disallow empty prefixes in parse_boolean_term Austin Clements
                   ` (2 preceding siblings ...)
  2013-01-08  0:58 ` David Bremner
@ 2013-01-08  3:04 ` David Bremner
  3 siblings, 0 replies; 5+ messages in thread
From: David Bremner @ 2013-01-08  3:04 UTC (permalink / raw)
  To: Austin Clements, notmuch

Austin Clements <amdragon@MIT.EDU> writes:

> Xapian doesn't consider ":abc" to be a prefixed term.  This makes
> parse_boolean_term similarly reject queries with an empty prefix.
> ---

pushed.

d

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-01-08  3:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-07 21:20 [PATCH] string-util: Disallow empty prefixes in parse_boolean_term Austin Clements
2013-01-07 22:12 ` Jani Nikula
2013-01-08  0:37 ` David Bremner
2013-01-08  0:58 ` David Bremner
2013-01-08  3:04 ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).