summaryrefslogtreecommitdiff
path: root/src/regex.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/regex.c')
-rw-r--r--src/regex.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/regex.c b/src/regex.c
index b44d958..2eacacc 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -82,7 +82,7 @@ char *regmatch_dup (regmatch_t * m, const char *src)
char *str;
size_t len;
- if (m == NULL || m->rm_so < 0)
+ if (m == NULL || m->rm_so < 0 || m->rm_eo < m->rm_so)
return NULL;
len = (size_t) (m->rm_eo - m->rm_so);
str = malloc((len + 1) * sizeof(char));