aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Marie <semarie@users.noreply.github.com>2015-06-22 13:42:08 +0200
committerSébastien Marie <semarie@users.noreply.github.com>2015-06-22 13:42:08 +0200
commitf87380994e9d2df719d483664e776e475e27d221 (patch)
tree7641126327ee2c36897a0c1b3607f1a6e8624a23
parent3e7417278dfa7c202b1325e78413714a76f0d3c5 (diff)
downloadhttpd-f87380994e9d2df719d483664e776e475e27d221.tar.gz
httpd-f87380994e9d2df719d483664e776e475e27d221.zip
several cosmetics fixes + add a new error checking
- there is no need to escape "%" with "%%" in error message - corrects a comment - add a check for error
-rw-r--r--httpd/patterns.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/httpd/patterns.c b/httpd/patterns.c
index 8fbaa28..1dbea15 100644
--- a/httpd/patterns.c
+++ b/httpd/patterns.c
@@ -215,7 +215,7 @@ matchbalance(struct match_state *ms, const char *s, const char *p)
{
if (p >= ms->p_end - 1) {
match_error(ms,
- "malformed pattern (missing arguments to '%%b')");
+ "malformed pattern (missing arguments to '%b')");
return (NULL);
}
if (*s != *p)
@@ -308,6 +308,8 @@ match_capture(struct match_state *ms, const char *s, int l)
{
size_t len;
l = check_capture(ms, l);
+ if (l == -1)
+ return NULL;
len = ms->capture[l].len;
if ((size_t) (ms->src_end - s) >= len &&
memcmp(ms->capture[l].init, s, len) == 0)
@@ -370,7 +372,7 @@ match(struct match_state *ms, const char *s, const char *p)
p += 2;
if (*p != '[') {
match_error(ms, "missing '['"
- " after '%%f' in pattern");
+ " after '%f' in pattern");
break;
}
/* points to what is next */
@@ -667,7 +669,7 @@ str_match(const char *string, const char *pattern, struct str_match *m,
ret = str_find_aux(&ms, pattern, string, sm, nsm, 0);
if (ret == 0 || ms.error != NULL) {
- /* Return 0 on error and store the error string */
+ /* Return -1 on error and store the error string */
*errstr = ms.error;
return (-1);
}