diff --git a/src/rcfile.c b/src/rcfile.c index 372482c29d75df0259d572471f763e08aff6c964..42c21df19b5a76cd5376ef0984ec0e768c977394 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -701,7 +701,11 @@ void parse_colors(char *ptr, int rex_flags) if (ptr == NULL) break; - goodstart = nregcomp(fgstr, rex_flags); + if (*fgstr == '\0') { + rcfile_error(N_("Empty regex string")); + goodstart = FALSE; + } else + goodstart = nregcomp(fgstr, rex_flags); /* If the starting regex is valid, initialize a new color struct, * and hook it in at the tail of the linked list. */ @@ -751,6 +755,11 @@ void parse_colors(char *ptr, int rex_flags) if (ptr == NULL) break; + if (*fgstr == '\0') { + rcfile_error(N_("Empty regex string")); + continue; + } + /* If the start regex was invalid, skip past the end regex * to stay in sync. */ if (!goodstart)