summaryrefslogtreecommitdiff
path: root/usr.sbin/httpd
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2015-08-18 08:26:40 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2015-08-18 08:26:40 +0000
commit30e2bac16499ed22a3c0ae02be09dde4e00cccf4 (patch)
tree4470b1a381d6d4d0ebb9aa7c15a453e75cc71501 /usr.sbin/httpd
parent3d4b5a931a9997ea73661b6ef67ac7ce02525b9d (diff)
str_match() checked the return value of str_find_aux() incorrectly: it
might return a negative number; the return value of match_error() which returns (-1). This was technically a bug, and it exists in 5.8, but there is no impact because the error is correctly catched with the returned non-NULL error string. Found by Leandro Pereira
Diffstat (limited to 'usr.sbin/httpd')
-rw-r--r--usr.sbin/httpd/patterns.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/httpd/patterns.c b/usr.sbin/httpd/patterns.c
index 27a813f90a2..42e4b25accc 100644
--- a/usr.sbin/httpd/patterns.c
+++ b/usr.sbin/httpd/patterns.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: patterns.c,v 1.3 2015/06/26 10:07:48 semarie Exp $ */
+/* $OpenBSD: patterns.c,v 1.4 2015/08/18 08:26:39 reyk Exp $ */
/*
* Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
@@ -26,7 +26,7 @@
/*
* Derived from Lua 5.3.1:
- * $Id: patterns.c,v 1.3 2015/06/26 10:07:48 semarie Exp $
+ * $Id: patterns.c,v 1.4 2015/08/18 08:26:39 reyk Exp $
* Standard library for string operations and pattern-matching
*/
@@ -673,7 +673,7 @@ str_match(const char *string, const char *pattern, struct str_match *m,
memset(m, 0, sizeof(*m));
ret = str_find_aux(&ms, pattern, string, sm, nsm, 0);
- if (ret == 0 || ms.error != NULL) {
+ if (ret <= 0 || ms.error != NULL) {
/* Return -1 on error and store the error string */
*errstr = ms.error;
return (-1);