diff --git a/libiberty/regex.c b/libiberty/regex.c index bc36f43d450..8337deaef5a 100644 --- a/libiberty/regex.c +++ b/libiberty/regex.c @@ -3468,7 +3468,7 @@ PREFIX(regex_compile) (const char *ARG_PREFIX(pattern), PATFETCH (c); if ((c == '.' && *p == ']') || p == pend) break; - if (c1 < sizeof (str)) + if (c1 < sizeof (str) - 1) str[c1++] = c; else /* This is in any case an invalid class name. */